Workflow file for this run
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
name: Build, Push Multi-Platform Docker Image to GHCR and Create Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # Triggers on tags like v1.0.0, v2.3.4, etc. | |
jobs: | |
build-and-push: | |
name: Build and Push Multi-Platform Docker Image to GHCR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Convert Repository Owner to Lowercase | |
id: lower_owner | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
return { owner: context.repo.owner.toLowerCase() } | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
# Use the lowercased owner from the previous step | |
tags: ghcr.io/${{ steps.lower_owner.outputs.owner }}/${{ github.event.repository.name }}:${{ github.ref_name }} | |
create_release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
needs: build-and-push | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
body: | | |
Docker image built and pushed to GitHub Container Registry (ghcr.io) | |
for platforms: linux/amd64 and linux/arm64. | |
draft: false | |
prerelease: false |