Merge branch 'release/0.4.0' #2
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 & Release | |
on: | |
push: | |
tags: | |
# https://semver.org/#spec-item-2 | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
# https://semver.org/#spec-item-9 | |
- 'v[0-9]+.[0-9]+.[0-9]+-beta.rc[0-9]+' | |
branches: | |
- "main" | |
- "develop" | |
jobs: | |
build-image: | |
name: Buld Docker Image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Login to Github Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Gather Docker metadata | |
id: docker-meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
tags: | | |
# Tag branches with branch name | |
type=ref,event=branch | |
# Process semver tags | |
# For a tag x.y.z or vX.Y.Z, output an x.y.z and x.y image tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.docker-meta.outputs.tags }} | |
labels: ${{ steps.docker-meta.outputs.labels }} | |
create-release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
permissions: | |
contents: write | |
needs: | |
- build-image | |
steps: | |
- | |
uses: actions/checkout@v4 | |
- | |
name: Get latest release info | |
id: query-release-info | |
uses: release-flow/keep-a-changelog-action@v3 | |
with: | |
command: query | |
version: ${{ github.ref_name }} | |
- | |
name: Display release info | |
run: | | |
echo "Version: ${{ steps.query-release-info.outputs.version }}" | |
echo "Date: ${{ steps.query-release-info.outputs.release-date }}" | |
echo "${{ steps.query-release-info.outputs.release-notes }}" | |
- | |
uses: ncipollo/release-action@v1 | |
with: | |
body: ${{ steps.query-release-info.outputs.release-notes }} |