Publish Docker Image (version: 1.0.0) #10
This file contains hidden or 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
# See. https://docs.docker.com/build/ci/github-actions/multi-platform/ | |
name: Publish Docker Image | |
run-name: "${{ github.workflow }} (version: ${{ inputs.version || 'latest only' }})" | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Docker Image Version (e.g., 1.0.0). Leave empty for 'latest' only." | |
required: false | |
default: "" | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Prepare tags | |
id: prepare_tags | |
run: | | |
if [ -z "${{ inputs.version }}" ]; then | |
echo "TAGS=daido1976/aws-lambda-function-url-emulator:latest" >> $GITHUB_ENV | |
else | |
echo "TAGS=daido1976/aws-lambda-function-url-emulator:latest,daido1976/aws-lambda-function-url-emulator:${{ inputs.version }}" >> $GITHUB_ENV | |
fi | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ env.TAGS }} |