Skip to content

Release

Release #9

Workflow file for this run

name: Release
on:
push:
branches:
- prod
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g. 1.2.3, leave empty to auto-bump patch)'
required: false
type: string
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SHIMMY_DEPLOY_TOKEN }}
- name: Check for existing tag on HEAD
id: idempotency
run: |
EXISTING=$(git describe --exact-match --tags HEAD 2>/dev/null || true)
if echo "$EXISTING" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "HEAD is already tagged as $EXISTING — skipping release."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Determine version
if: steps.idempotency.outputs.skip == 'false'
id: version
run: |
if [ -n "${{ inputs.version }}" ]; then
NEW_VERSION="v${{ inputs.version }}"
else
LATEST=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
MAJOR=$(echo "${LATEST#v}" | cut -d. -f1)
MINOR=$(echo "${LATEST#v}" | cut -d. -f2)
PATCH=$(echo "${LATEST#v}" | cut -d. -f3)
NEW_VERSION="v${MAJOR}.${MINOR}.$((PATCH + 1))"
fi
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
echo "Releasing ${NEW_VERSION}"
- name: Create and push tag
if: steps.idempotency.outputs.skip == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ steps.version.outputs.version }}
git push origin ${{ steps.version.outputs.version }}
- name: Create GitHub Release
if: steps.idempotency.outputs.skip == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.version.outputs.version }} \
--generate-notes \
--title "Release ${{ steps.version.outputs.version }}"
- name: Trigger evaluation-function-base release
if: steps.idempotency.outputs.skip == 'false'
env:
GH_TOKEN: ${{ secrets.SHIMMY_DEPLOY_TOKEN }}
run: |
jq -n --arg v "${{ steps.version.outputs.version }}" \
'{"event_type":"release","client_payload":{"shimmy_version":$v}}' | \
gh api repos/${{ github.repository_owner }}/evaluation-function-base/dispatches \
--method POST --input -