Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,34 @@ on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Existing release tag to repair'
required: true
type: string

concurrency:
group: publish


jobs:
publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
name: Upload release to Github Releases and PyPI
name: Upload release to GitHub Releases
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
environment: publish
env:
TAG_NAME: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/tags/${{ env.TAG_NAME }}
- name: Set up Python 3.12
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build package
Expand All @@ -37,5 +45,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.ref_name }} --repo ${{ github.repository }} --verify-tag --generate-notes --title "Release ${{ github.ref_name }}"
gh release upload ${{ github.ref_name }} --repo ${{ github.repository }} dist/*
if gh release view "$TAG_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release edit "$TAG_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag --title "Release $TAG_NAME"
else
gh release create "$TAG_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag --generate-notes --title "Release $TAG_NAME"
fi
gh release upload "$TAG_NAME" --repo "$GITHUB_REPOSITORY" --clobber dist/*
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ git push upstream v0.4.5
Replace `upstream` with the name of the remote you push releases to. Pushing a
`v*` tag triggers the publish workflow, which creates a GitHub release titled
`Release v0.4.5` and generates its release notes.

To repair package assets on an existing tag, run the **Publish Package**
workflow manually and enter the tag name (for example, `v0.4.5`). The workflow
can update an existing release and replace its uploaded package files.
Loading