Skip to content

Release

Release #4

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
packages: write
jobs:
build-and-push:
name: Build & push Docker images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push frontend image
uses: docker/build-push-action@v5
with:
context: ./frontend
file: ./frontend/Dockerfile.prod
push: true
tags: |
ghcr.io/${{ github.repository }}/frontend:${{ steps.version.outputs.VERSION }}
ghcr.io/${{ github.repository }}/frontend:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push backend image
uses: docker/build-push-action@v5
with:
context: ./backend
file: ./backend/Dockerfile.prod
push: true
tags: |
ghcr.io/${{ github.repository }}/backend:${{ steps.version.outputs.VERSION }}
ghcr.io/${{ github.repository }}/backend:latest
cache-from: type=gha
cache-to: type=gha,mode=max
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build-and-push
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract changelog for this version
id: changelog
run: |
VERSION="${GITHUB_REF_NAME#v}"
# Extract from the version header until the next header or end of section
NOTES=$(sed -n "/^## \[$VERSION\]/,/^## \|^---/p" CHANGELOG.md | sed '$d' | tail -n +2)
if [ -z "$NOTES" ]; then
NOTES="See [CHANGELOG.md](CHANGELOG.md) for full release notes."
fi
echo "NOTES<<EOF" >> "$GITHUB_OUTPUT"
echo "$NOTES" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Create Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.changelog.outputs.NOTES }}
generate_release_notes: true