Bump actions/checkout from 3 to 4 (#18) #12
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 Docker image | |
on: | |
push: | |
branches: | |
- main | |
- master | |
tags: | |
- '*' | |
env: | |
IMAGE_NAME: ios-aurora-push | |
NODE_VERSION: 18 | |
jobs: | |
build-and-push-image: | |
runs-on: [self-hosted, linux] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Extract short git hash | |
id: vars | |
run: | | |
echo sha_short=$(echo $GITHUB_SHA | head -c7) >> $GITHUB_OUTPUT | |
echo branch_name=$(echo ${GITHUB_REF##*/}) >> $GITHUB_OUTPUT | |
echo TS=$(date +%s) >> $GITHUB_OUTPUT | |
- name: Log in to the Container registry | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
with: | |
registries: '072270118115' | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ steps.login-ecr.outputs.registry }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha,prefix=${{ steps.vars.outputs.branch_name }}-,suffix=-${{ steps.vars.outputs.ts }} | |
type=ref,event=branch | |
type=ref,event=tag | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup docker context for buildx | |
id: buildx-context | |
run: docker context create builders | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
endpoint: builders | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
file: Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64, linux/arm64 |