Merge pull request #108 from PasseiDireto/update-runner-2.321.0 #85
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: Builds and pushes tagged image to ECR and DockerHub | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build_push_ecr: | |
name: Push image to ECR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Buildx to build image | |
uses: docker/setup-buildx-action@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
role-to-assume: ${{ secrets.AWS_ECR_ROLE }} | |
- name: Docker login | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{secrets.AWS_PROD_ACCOUNT_ID}}.dkr.ecr.${{secrets.AWS_DEFAULT_REGION}}.amazonaws.com | |
- name: Find Git Tag | |
run: echo "TAG=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- name: Docker Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: | | |
${{secrets.AWS_PROD_ACCOUNT_ID}}.dkr.ecr.${{secrets.AWS_DEFAULT_REGION}}.amazonaws.com/gh-runner:latest | |
${{secrets.AWS_PROD_ACCOUNT_ID}}.dkr.ecr.${{secrets.AWS_DEFAULT_REGION}}.amazonaws.com/gh-runner:${{ env.TAG }} | |
build_push_docker_hub: | |
name: Push image Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Buildx to build image | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Find Git Tag | |
run: echo "TAG=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- name: Docker Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: | | |
passeidireto/gh-runner:latest | |
passeidireto/gh-runner:${{ env.TAG }} | |
trigger-test-workflow: | |
name: Triggers simple test workflow to ensure everything still working as expected | |
runs-on: ubuntu-latest | |
needs: build_push_ecr | |
steps: | |
- name: Trigger external action | |
uses: passeidireto/trigger-external-workflow-action@main | |
if: success() | |
with: | |
repository: PasseiDireto/gh-runner | |
event: successful_release | |
github_pat: ${{ secrets.PD_BOT_GITHUB_ACCESS_TOKEN }} |