Release #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Tag to release (example: v1.2.3)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release-${{ github.ref_name || inputs.tag }} | |
| cancel-in-progress: false | |
| jobs: | |
| publish-release: | |
| name: Publish GitHub Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Resolve and validate release tag | |
| id: tag | |
| shell: bash | |
| run: | | |
| git fetch --force --tags origin | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| TAG="${{ inputs.tag }}" | |
| else | |
| TAG="${{ github.ref_name }}" | |
| fi | |
| if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.]+)?$ ]]; then | |
| echo "Invalid release tag: $TAG" | |
| exit 1 | |
| fi | |
| git rev-parse "$TAG" >/dev/null 2>&1 | |
| echo "value=$TAG" >> "$GITHUB_OUTPUT" | |
| - name: Generate release notes | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| RELEASE_NOTES_MODEL: ${{ secrets.RELEASE_NOTES_MODEL }} | |
| OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }} | |
| run: | | |
| export RELEASE_NOTES_MODEL="${RELEASE_NOTES_MODEL:-gpt-4o-mini}" | |
| export OPENAI_BASE_URL="${OPENAI_BASE_URL:-https://api.openai.com/v1/chat/completions}" | |
| python3 scripts/generate_release_notes.py \ | |
| --tag "${{ steps.tag.outputs.value }}" \ | |
| --output ".github/release-notes.md" | |
| - name: Create or update GitHub release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ steps.tag.outputs.value }} | |
| shell: bash | |
| run: | | |
| title="$TAG" | |
| prerelease="" | |
| if [[ "$TAG" == *-* ]]; then | |
| prerelease="--prerelease" | |
| fi | |
| if gh release view "$TAG" >/dev/null 2>&1; then | |
| gh release edit "$TAG" \ | |
| --title "$title" \ | |
| --notes-file ".github/release-notes.md" | |
| else | |
| gh release create "$TAG" \ | |
| --title "$title" \ | |
| --verify-tag \ | |
| --notes-file ".github/release-notes.md" \ | |
| $prerelease | |
| fi |