Skip to content

Merge pull request #31 from automagik-dev/fix/release-oauth-credentials #27

Merge pull request #31 from automagik-dev/fix/release-oauth-credentials

Merge pull request #31 from automagik-dev/fix/release-oauth-credentials #27

Workflow file for this run

name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag to (re)release (e.g. v2.260227.1)"
required: true
type: string
permissions:
contents: write
jobs:
test:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Test
run: go test ./...
worker:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack (pnpm)
run: |
corepack enable
corepack prepare pnpm@10.27.0 --activate
- name: Install dependencies
run: pnpm -C internal/tracking/worker install --frozen-lockfile
- name: Build
run: pnpm -C internal/tracking/worker build
- name: Test
run: pnpm -C internal/tracking/worker test
goreleaser:
needs: [test, worker]
runs-on: macos-latest
env:
GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Resolve tag
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Checkout release tag
run: git checkout ${{ steps.tag.outputs.tag }}
- name: Find previous release tag
id: prev
run: |
PREV=$(git tag --list 'v*' --sort=-version:refname | grep -v "^${{ steps.tag.outputs.tag }}$" | head -1)
echo "tag=${PREV:-}" >> "$GITHUB_OUTPUT"
echo "Previous tag: ${PREV:-none}"
- name: Install git-cliff
run: |
curl -sSfL https://github.com/orhun/git-cliff/releases/download/v2.7.0/git-cliff-2.7.0-aarch64-apple-darwin.tar.gz \
| tar xz -C /tmp
chmod +x /tmp/git-cliff-2.7.0/git-cliff
sudo mv /tmp/git-cliff-2.7.0/git-cliff /usr/local/bin/git-cliff
git cliff --version
- name: Generate release notes with git-cliff
run: |
if [ -n "${{ steps.prev.outputs.tag }}" ]; then
RANGE="${{ steps.prev.outputs.tag }}..${{ steps.tag.outputs.tag }}"
else
RANGE="${{ steps.tag.outputs.tag }}"
fi
git cliff --config cliff.toml $RANGE --output /tmp/release-notes.md
cat /tmp/release-notes.md
env:
GITHUB_REPO: ${{ github.repository }}
- name: Stash GoReleaser config
run: cp .goreleaser.yaml /tmp/.goreleaser.yaml
- name: GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean --config /tmp/.goreleaser.yaml --release-notes /tmp/release-notes.md
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
WK_CLIENT_ID: ${{ secrets.WK_CLIENT_ID }}
WK_CLIENT_SECRET: ${{ secrets.WK_CLIENT_SECRET }}