Skip to content
Merged
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
55 changes: 0 additions & 55 deletions .github/release-drafter.yml

This file was deleted.

48 changes: 10 additions & 38 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- 'v*'
workflow_dispatch:

permissions:
contents: read
Expand Down Expand Up @@ -64,48 +65,19 @@ jobs:

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1

release:
needs: publish-to-pypi
if: github.event_name == 'push'
needs:
- publish-to-pypi
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 5
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Fetch annotated tag message
run: git fetch --force origin "refs/tags/${GITHUB_REF_NAME}:refs/tags/${GITHUB_REF_NAME}"
- name: Publish GitHub Release
- name: Create GitHub release if missing
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_REF="refs/tags/${GITHUB_REF_NAME}"
HIGHLIGHTS=""
if [ "$(git cat-file -t "$TAG_REF" 2>/dev/null || true)" = "tag" ]; then
HIGHLIGHTS=$(git for-each-ref "$TAG_REF" --format='%(contents)' | sed '/^-----BEGIN PGP SIGNATURE-----/,$d')
if [ -z "$(printf '%s' "$HIGHLIGHTS" | tr -d '[:space:]')" ]; then
HIGHLIGHTS=""
fi
fi

RELEASE_ID=$(gh api "repos/${GITHUB_REPOSITORY}/releases?per_page=100" --jq 'map(select(.draft))[0].id // empty')
if [ -n "$RELEASE_ID" ]; then
BODY=$(gh api "repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" --jq '.body // ""')
if [ -n "$HIGHLIGHTS" ]; then
BODY=$(printf '## Highlights\n\n%s\n\n%s' "$HIGHLIGHTS" "$BODY")
fi
jq -n \
--arg tag_name "$GITHUB_REF_NAME" \
--arg name "$GITHUB_REF_NAME" \
--arg body "$BODY" \
'{tag_name: $tag_name, name: $name, body: $body, draft: false, make_latest: "true"}' \
> /tmp/release.json
gh api --method PATCH "repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" --input /tmp/release.json
elif [ -n "$HIGHLIGHTS" ]; then
gh release create "$GITHUB_REF_NAME" --verify-tag --generate-notes \
--title "$GITHUB_REF_NAME" --latest \
--notes "$(printf '## Highlights\n\n%s' "$HIGHLIGHTS")"
else
gh release create "$GITHUB_REF_NAME" --verify-tag --generate-notes \
--title "$GITHUB_REF_NAME" --latest
fi
TAG: ${{ github.ref_name }}
# Manual `git push origin v*` tags have no release yet; release-please
# dispatch never reaches this job (it only runs on push).
run: gh release view "$TAG" > /dev/null 2>&1 || gh release create "$TAG" --generate-notes --verify-tag
29 changes: 0 additions & 29 deletions .github/workflows/release-drafter.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release Please

on:
push:
branches: [master]

permissions:
actions: write
contents: write
pull-requests: write

jobs:
release-please:
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Trigger publish workflow
if: ${{ steps.release.outputs.release_created }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.release.outputs.tag_name }}
run: gh workflow run publish.yml --repo "$GITHUB_REPOSITORY" --ref "$TAG"
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "3.0.1"
}
12 changes: 12 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"release-type": "python",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"include-component-in-tag": false,
"skip-changelog": true
}
}
}