fix: fix concurrent run of serve command #348
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Docker ilc auth | |
run: echo "${{ secrets.DOCKER_HUB_TOKEN_ARCH_ACCOUNT }}" | docker login --username techarchitectsteam --password-stdin | |
- name: Build the Docker image | |
run: | | |
docker build --tag apps:tmp --build-arg VCS_REF=${GITHUB_SHA:0:7} . | |
- name: Calc tags | |
id: tags | |
run: | | |
BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-99) | |
LATEST=$([ "$BRANCH" == "master" ] && echo "latest,${GITHUB_SHA:0:7}," || echo "") | |
DOCKER_TAGS="$LATEST${BRANCH//\//_}" | |
echo "Tags that will be used: $DOCKER_TAGS" | |
echo ::set-output name=docker_tags::$DOCKER_TAGS | |
- name: Push image | |
run: | | |
TAGS="${{ steps.tags.outputs.docker_tags }}" | |
for i in ${TAGS//,/ } | |
do | |
docker tag apps:tmp namecheap/ilc-demo-apps:$i | |
docker push namecheap/ilc-demo-apps:$i | |
done | |
- name: Deploy demo site | |
if: github.ref == 'refs/heads/master' | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEMO_INSTANCE_HOST }} | |
username: ec2-user | |
key: ${{ secrets.DEMO_INSTANCE_SSH_KEY }} | |
port: 22 | |
script_stop: true | |
script: | | |
curl -L https://raw.githubusercontent.com/namecheap/ilc/master/docker-compose.yml -o /home/ec2-user/docker-compose.yml | |
echo "PUBLIC_HOST=demo.microfrontends.online" > /home/ec2-user/demo-apps.env | |
docker image prune --all -f | |
docker-compose pull | |
docker-compose up -d | |
sleep 20 | |
docker-compose run -e OVERRIDE_CONFIG_TRUSTED_ORIGINS=all -e PUBLIC_HOST=demo.microfrontends.online registry npm run seed |