Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,44 @@ on:
description: "Version Number (semver: 1.2.3)"
required: true
type: string

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ "linux/amd64", "linux/arm64" ]
# Use GitHub-hosted runner for amd64 and the arm64 partner runner for arm64
runs-on: ${{ matrix.platform == 'linux/arm64' && 'arm-ubuntu-24' || 'ubuntu-latest' }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# We don't need QEMU since we're running on native hardware.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

#Login against a Docker registry except on PR
#https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate build ID
id: prep
run: |
branch=${GITHUB_REF##*/}
sha=${GITHUB_SHA::8}
ts=$(date +%s)
echo "::set-output name=BUILD_ID::${branch}-${sha}-${ts}"
echo "BUILD_ID=${branch}-${sha}-${ts}" >> $GITHUB_OUTPUT

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
Expand All @@ -59,24 +59,23 @@ jobs:
type=raw,value=latest
type=raw,value=${{ steps.prep.outputs.BUILD_ID }}
type=raw,value=${{ inputs.version }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image

- name: Build and push Docker image for ${{ matrix.platform }}
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

release:
needs:
- build
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: "marvinpinto/action-automatic-releases@latest"
- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ inputs.version }}
Expand All @@ -87,8 +86,7 @@ jobs:
permissions:
pull-requests: write
contents: write
needs:
- release
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -100,6 +98,7 @@ jobs:
run: |
git config user.name "GitHub Actions"
git config user.email noreply@github.com

- name: Update Changelog
uses: thomaseizinger/keep-a-changelog-new-release@v3
with:
Expand All @@ -110,11 +109,12 @@ jobs:
run: |
git add CHANGELOG.md
git commit --message "Prepare release ${{ inputs.version }}"
echo "::set-output name=commit::$(git rev-parse HEAD)"
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

- name: Push commit
run: |
git push origin release/${{ inputs.version }}

- name: Create pull request into main
uses: thomaseizinger/create-pull-request@1.4.0
with:
Expand All @@ -126,6 +126,7 @@ jobs:
body: |
This PR was created when the Create Release workflow was run.
I've updated the version name and code commit: ${{ steps.make-commit.outputs.commit }}.

- name: Create pull request into development
uses: thomaseizinger/create-pull-request@1.4.0
with:
Expand Down
Loading