update (#9380) #378
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: Create and publish docker image on ECR | |
on: | |
push: | |
branches: master | |
tags: | |
- "*" | |
jobs: | |
ecr_public: | |
runs-on: ubuntu-latest | |
name: ECR public action | |
if: github.repository == 'Netflix/consoleme' | |
steps: | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install AWS CLI | |
run: |- | |
pip install awscli | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Public ECR | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.CONSOLEME_DEMO_USER_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CONSOLEME_DEMO_USER_SECRET_ACCESS_KEY }} | |
run: | | |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws | |
- name: Build ConsoleMe | |
run: | | |
docker build -t consoleme . | |
- name: Tag, and push unstable image to Amazon ECR | |
run: | | |
docker tag consoleme public.ecr.aws/consoleme/consoleme:unstable | |
docker push --all-tags public.ecr.aws/consoleme/consoleme | |
- name: Tag, and push versioned image to ECR on tag | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
# Extract tags from version | |
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") | |
# Tag image | |
docker tag consoleme public.ecr.aws/consoleme/consoleme:$CONSOLEME_VERSION | |
docker tag consoleme public.ecr.aws/consoleme/consoleme:$CONSOLEME_MAJOR | |
docker tag consoleme public.ecr.aws/consoleme/consoleme:$CONSOLEME_MINOR | |
docker tag consoleme public.ecr.aws/consoleme/consoleme:$CONSOLEME_PATCH | |
docker tag consoleme public.ecr.aws/consoleme/consoleme:latest | |
docker push --all-tags public.ecr.aws/consoleme/consoleme |