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: Build subway docker image and push to ECR. | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- alephzero | |
paths-ignore: | |
- ".github/**" | |
- "*.md" | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
check-vars-and-secrets: | |
name: Check vars and secrets | |
uses: ./.github/workflows/_check-vars-and-secrets.yml | |
secrets: inherit | |
build-and-push-subway: | |
name: Build and push subway image | |
needs: [check-vars-and-secrets] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: GIT | Checkout Source code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Call action get-ref-properties | |
id: get-ref-properties | |
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v6 | |
- name: Get subway image name | |
id: get-image-name | |
env: | |
ECR_REGISTRY: '${{ vars.ECR_PUBLIC_REGISTRY }}' | |
APP: subway | |
TAG: '${{ steps.get-ref-properties.outputs.sha }}' | |
shell: bash | |
run: | | |
image=${{ env.ECR_REGISTRY }}${{ env.APP }}:${{ env.TAG }} | |
echo "image=${image}" >> $GITHUB_OUTPUT | |
- name: Build docker image | |
run: | | |
docker build --tag '${{ steps.get-image-name.outputs.image }}' -f ./Dockerfile . | |
- name: Login to ECR | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ vars.ECR_PUBLIC_HOST }} | |
username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} | |
password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} | |
- name: Push image to the ECR registry | |
id: push-image | |
run: | | |
docker push '${{ steps.get-image-name.outputs.image }}' |