This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
Build new image with latest amazon/aws-cli:2.13.4 #2
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: Build & push image workflow | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: Reference to build image from. `master` will push the `latest` tag. | |
type: string | |
required: false | |
default: master | |
env: | |
REGISTRY: ghcr.io # Using GH Packages for hosting public images | |
IMAGE_NAME: ${{ github.repository }} | |
LATEST: ${{ inputs == null && github.ref_name == 'master' || inputs.ref == 'master' }} | |
jobs: | |
build-push-image: | |
name: Build & push image | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout ${{ github.repository }} | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha,enable=true,priority=100,prefix=,suffix=_${{ github.run_number }},format=short | |
type=raw,value=latest,enable=${{env.LATEST}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3.3.0 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |