new ecr url, better error messages, path fixes #73
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
# .github/workflows/public-ecr.yml | |
name: Build and Push ecs-deploy | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
permissions: | |
id-token: write | |
contents: write # This is required for actions/checkout@v1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git clone the repository | |
uses: actions/checkout@v1 | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@master | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNTID }}:role/github-openvpn | |
role-session-name: samplerolesession | |
aws-region: eu-west-1 | |
- name: Docker Login (ECR) | |
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/y9x3p3i6 | |
- name: Docker Login (Docker Hub) | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker Builld | |
run: docker build -t ecs-deploy . | |
- name: Tag and push latest | |
if: endsWith(github.ref, '/master') | |
run: | | |
docker tag ecs-deploy:latest public.ecr.aws/y9x3p3i6/ecs-deploy:latest | |
docker tag ecs-deploy:latest in4it/ecs-deploy:latest | |
docker push public.ecr.aws/y9x3p3i6/ecs-deploy:latest | |
docker push in4it/ecs-deploy:latest | |
- name: Tag and push specific version | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
docker tag ecs-deploy:latest public.ecr.aws/y9x3p3i6/ecs-deploy:${GITHUB_REF/refs\/tags\//} | |
docker tag ecs-deploy:latest in4it/ecs-deploy:${GITHUB_REF/refs\/tags\//} | |
docker push public.ecr.aws/y9x3p3i6/ecs-deploy:${GITHUB_REF/refs\/tags\//} | |
docker push in4it/ecs-deploy:${GITHUB_REF/refs\/tags\//} |