Skip to content

Merge pull request #104 from NorthShoreAutomation/release/2.2.0 #54

Merge pull request #104 from NorthShoreAutomation/release/2.2.0

Merge pull request #104 from NorthShoreAutomation/release/2.2.0 #54

Workflow file for this run

name: Create Release
on:
push:
tags:
- "*"
workflow_call:
inputs:
publish_test:
description: "Whether to publish to test PyPI instead of main PyPI"
required: false
type: boolean
default: false
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # create the GitHub release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: Extract release name from changelog
id: get_release_name
# docs/CHANGELOG.md is the 1.x changelog and may have no entry for
# this tag; fall back to a plain name rather than failing the job.
run: |
VERSION="${{ steps.get_version.outputs.VERSION }}"
RELEASE_NAME=""
if [ -f docs/CHANGELOG.md ]; then
VERSION_LINE=$(grep -m1 -F "${VERSION#v}" docs/CHANGELOG.md || true)
RELEASE_NAME=$(echo "$VERSION_LINE" | grep -o '"[^"]*"' | head -n1 | tr -d '"' || true)
fi
if [ -z "$RELEASE_NAME" ]; then
RELEASE_NAME="Release"
fi
echo "Release name: ${RELEASE_NAME}"
echo "RELEASE_NAME=${RELEASE_NAME}" >> "$GITHUB_OUTPUT"
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: "${{ steps.get_version.outputs.VERSION }} - ${{ steps.get_release_name.outputs.RELEASE_NAME }}"
draft: false
prerelease: false
generate_release_notes: true
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: release
uses: ./.github/workflows/publish.yml
permissions:
contents: read
id-token: write # publish.yml needs this for PyPI trusted publishing
with:
publish_test: ${{ inputs.publish_test == true }}
secrets: inherit