Mirror pghero image to ECR when versions.json/Dockerfile changes #39
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: Mirror pghero image to ECR when versions.json/Dockerfile changes | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "versions.json" | |
- "Dockerfile" | |
schedule: | |
- cron: '0 0 1,15 * *' | |
workflow_dispatch: | |
jobs: | |
prepare-build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Capture argo image versions | |
id: componentVersions | |
run: | | |
echo "config=$(jq -c .components versions.json)" >> $GITHUB_OUTPUT | |
- name: Upload versions file | |
uses: actions/upload-artifact@v2 | |
with: | |
name: versions | |
path: versions.json | |
outputs: | |
config: ${{ steps.componentVersions.outputs.config }} | |
mirror: | |
runs-on: ubuntu-20.04 | |
needs: prepare-build | |
strategy: | |
matrix: | |
versions: ${{ fromJson(needs.prepare-build.outputs.config) }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build and push argo images to ECR | |
uses: kciter/aws-ecr-action@v4 | |
with: | |
access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
account_id: '008577686731' | |
repo: dsva/pghero | |
region: us-gov-west-1 | |
tags: "${{ matrix.versions['name']}}-${{ matrix.versions['version'] }}" | |
dockerfile: Dockerfile | |
extra_build_args: "--build-arg APP_VERSION=${{ matrix.versions['version'] }} --build-arg REPO=${{ matrix.versions['repo'] }}" |