Skip to content

Release

Release #46

Workflow file for this run

name: Release
on:
release:
types: [published]
permissions:
contents: write
packages: write
jobs:
# Build and test
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm typecheck
- name: Run tests
run: pnpm test
- name: Get version from release
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ steps.version.outputs.VERSION }}
path: source/**/*
# Package Helm chart
helm:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version from release
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.14.4
- name: Create Helm package
run: |
helm package helm/database-backup --version ${{ steps.version.outputs.VERSION }} --app-version ${{ steps.version.outputs.VERSION }}
- name: Upload Helm package
uses: actions/upload-artifact@v4
with:
name: helm-${{ steps.version.outputs.VERSION }}
path: database-backup-${{ steps.version.outputs.VERSION }}.tgz
# Build and push Docker image to GitHub Container Registry
container:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Get version from release
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ steps.version.outputs.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate SBOM
uses: anchore/sbom-action@v0
with:
image: ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}
format: spdx-json
output-file: sbom.spdx.json
- name: Upload SBOM
uses: actions/upload-artifact@v4
with:
name: sbom-${{ steps.version.outputs.VERSION }}
path: sbom.spdx.json
# Upload release assets to the manually created GitHub Release
release-assets:
runs-on: ubuntu-latest
needs: [helm, container]
steps:
- name: Get version from release
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
- name: Download Helm package
uses: actions/download-artifact@v4
with:
name: helm-${{ steps.version.outputs.VERSION }}
path: release-assets
- name: Download SBOM
uses: actions/download-artifact@v4
with:
name: sbom-${{ steps.version.outputs.VERSION }}
path: release-assets
- name: List release assets
run: ls -la release-assets/
- name: Upload assets to existing release
uses: softprops/action-gh-release@v2
with:
files: |
release-assets/*.tgz
release-assets/*.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}