Skip to content

release pipeline test (#9378) #414

release pipeline test (#9378)

release pipeline test (#9378) #414

name: Publish Docker image and Deploy Demo Site
on:
push:
branches: master
tags:
- "*"
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
if: github.repository == 'Netflix/consoleme'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.CONSOLEME_DOCKERHUB_USERNAME }}
password: ${{ secrets.CONSOLEME_DOCKERHUB_PASSWORD }}
- name: Build ConsoleMe
run: |
docker build -t consoleme .
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Tag, and push unstable image to DockerHub
run: |
docker tag consoleme consoleme/consoleme:unstable
docker push --all-tags consoleme/consoleme
- name: Tag, and push versioned image to DockerHub on tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
export CONSOLEME_VERSION=$(python3 setup.py -q --version | sed -r 's/\+/\./g')
export CONSOLEME_MAJOR=$(cut -d '.' -f 1 <<< "$CONSOLEME_VERSION")
export CONSOLEME_MINOR=$(cut -d '.' -f 1,2 <<< "$CONSOLEME_VERSION")
export CONSOLEME_PATCH=$(cut -d '.' -f 1,2,3 <<< "$CONSOLEME_VERSION")
docker tag consoleme consoleme/consoleme:$CONSOLEME_VERSION
docker tag consoleme consoleme/consoleme:$CONSOLEME_MAJOR
docker tag consoleme consoleme/consoleme:$CONSOLEME_MINOR
docker tag consoleme consoleme/consoleme:$CONSOLEME_PATCH
docker tag consoleme consoleme/consoleme:latest
docker push --all-tags consoleme/consoleme
deploy_consoleme_demo_site:
name: Deploy Demo Site
if: github.repository == 'Netflix/consoleme'
needs: [push_to_registry]
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install AWS CLI
run: |-
pip install awscli
- name: Setup ECS CLI
run: |-
mkdir -p "$HOME/tools/ecs-cli"
curl -Lo "$HOME/tools/ecs-cli/ecs-cli" https://amazon-ecs-cli.s3.amazonaws.com/ecs-cli-linux-amd64-latest
chmod +x "$HOME/tools/ecs-cli/ecs-cli"
echo "$HOME/tools/ecs-cli" >> $GITHUB_PATH
- name: Configure AWS credentials for ConsoleMe demo account
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.CONSOLEME_DEMO_USER_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.CONSOLEME_DEMO_USER_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Copy configuration from S3
run: |-
aws s3 cp s3://consolemeoss/consolemeoss_deploy/docker-compose-ecs.yaml .
aws s3 cp s3://consolemeoss/consolemeoss_deploy/docker-compose-ecs-celery.yaml .
aws s3 cp s3://consolemeoss/consolemeoss_deploy/ecs-params.yml .
aws s3 cp s3://consolemeoss/consolemeoss_deploy/deploy.sh .
- name: Deploy ConsoleMe demo site to ECS Fargate
run: |-
chmod +x deploy.sh
./deploy.sh