Skip to content

Commit 0c2ae6d

Browse files
committed
wip: fix workflow trigger + docs to release/[0-9]*.[0-9]*.[0-9]*
1 parent bdbf11e commit 0c2ae6d

File tree

3 files changed

+88
-7
lines changed

3 files changed

+88
-7
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Release on Tag
2+
3+
on:
4+
push:
5+
tags:
6+
- 'release/[0-9]*.[0-9]*.[0-9]*'
7+
8+
permissions:
9+
contents: write # push tags, push commits
10+
pull-requests: write
11+
12+
concurrency:
13+
group: release-${{ github.ref }}
14+
cancel-in-progress: false
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up Java, Central creds and GPG
26+
uses: actions/setup-java@v4
27+
with:
28+
distribution: temurin
29+
java-version: '21'
30+
cache: maven
31+
server-id: central
32+
server-username: CENTRAL_USERNAME
33+
server-password: CENTRAL_PASSWORD
34+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
35+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
36+
37+
- name: Create GitHub Release with notes
38+
uses: softprops/action-gh-release@v2
39+
with:
40+
tag_name: ${{ github.ref_name }}
41+
generate_release_notes: true
42+
43+
- name: Build and Deploy to Central
44+
env:
45+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
46+
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
47+
run: |
48+
mvn -B -ntp clean deploy
49+
50+
- name: Configure Git identity
51+
run: |
52+
git config user.name "github-actions[bot]"
53+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
54+
55+
- name: Create branch from tag for PR
56+
id: prbranch
57+
run: |
58+
BRANCH_NAME="release-bot-$(date +%Y%m%d-%H%M%S)"
59+
git checkout -B "$BRANCH_NAME" $GITHUB_SHA
60+
git push origin "$BRANCH_NAME"
61+
echo "branch=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
62+
63+
- name: Open PR back to main
64+
env:
65+
GH_TOKEN: ${{ github.token }}
66+
run: |
67+
gh pr create \
68+
--title "chore: merge release ${{ github.ref_name }} to main" \
69+
--body "Automated PR created from tag ${{ github.ref_name }}." \
70+
--base main \
71+
--head "${{ steps.prbranch.outputs.branch }}" \
72+
|| echo "PR already exists or nothing to compare"

AGENTS.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ Prerequisites
8181
- Optional: alias `mvn` to `mvnd` for faster builds (see note at top).
8282

8383
Automated Release (preferred)
84-
- Push a tag named `releases/X.Y.Z` (semver, no leading `v`).
85-
- The workflow `.github/workflows/release-on-branch.yml` will:
84+
- Push a tag named `release/X.Y.Z` (semver, no leading `v`).
85+
- The workflow `.github/workflows/release-on-tag.yml` will:
8686
- Create a GitHub Release for that tag with autogenerated notes.
8787
- Build and deploy artifacts to Maven Central (Central Publishing plugin).
8888
- Create a branch `release-bot-YYYYMMDD-HHMMSS` at the tagged commit and open a PR back to `main` (no version bumps).
@@ -105,6 +105,11 @@ Notes
105105
- To skip signing locally for quick checks, add `-Dgpg.skip=true`.
106106
- The Central Publishing plugin configuration lives in the parent `pom.xml` and applies to all modules.
107107

108+
Secrets Helper
109+
- Use `./scripts/setup-release-secrets.zsh` to set GitHub Actions secrets (`CENTRAL_USERNAME`, `CENTRAL_PASSWORD`, `GPG_PRIVATE_KEY`, `GPG_PASSPHRASE`).
110+
- The script can auto-detect a signing key if neither `GPG_KEY_ID` nor `GPG_PRIVATE_KEY` is provided.
111+
- List keys explicitly with: `gpg --list-secret-keys --keyid-format=long`.
112+
108113
## Python Usage (Herodoc, 3.2-safe)
109114
- Prefer `python3` with a heredoc over Perl/sed for non-trivial transforms.
110115
- Target ancient Python 3.2 syntax: no f-strings, no fancy deps.

RELEASE-GIST.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Tag-Triggered Maven Central Release (GitHub Actions)
22

3-
- Trigger: push tag `releases/X.Y.Z` (no leading `v`).
3+
- Trigger: push tag `release/X.Y.Z` (no leading `v`).
44
- CI creates a GitHub Release from the tag, then deploys to Maven Central.
55
- CI opens a PR back to `main` from `release-bot-YYYYMMDD-HHMMSS` (no version bumps).
66

@@ -11,7 +11,7 @@ name: Release on Tag
1111
on:
1212
push:
1313
tags:
14-
- 'releases/*'
14+
- 'release/[0-9]*.[0-9]*.[0-9]*'
1515
permissions:
1616
contents: write
1717
pull-requests: write
@@ -62,7 +62,7 @@ jobs:
6262
- CENTRAL_USERNAME, CENTRAL_PASSWORD (Central Portal token)
6363
- GPG_PRIVATE_KEY (ASCII-armored secret key), GPG_PASSPHRASE
6464
65-
zsh helper (uses gh, gpg):
65+
zsh helper (uses gh, gpg) — auto-detects a signing key if not provided:
6666
6767
```zsh
6868
#!/usr/bin/env zsh
@@ -72,13 +72,17 @@ export CENTRAL_PASSWORD=your_pass
7272
export GPG_PASSPHRASE=your_passphrase
7373
export GPG_KEY_ID=YOUR_KEY_ID # or export GPG_PRIVATE_KEY="$(gpg --armor --export-secret-keys YOUR_KEY_ID)"
7474
./scripts/setup-release-secrets.zsh
75+
76+
# If you don't set GPG_KEY_ID or GPG_PRIVATE_KEY, the script tries to
77+
# auto-detect a signing key. To see candidates explicitly:
78+
gpg --list-secret-keys --keyid-format=long
7579
```
7680

7781
## Trigger a Release
7882

7983
```bash
80-
git tag 'releases/0.1.0'
81-
git push origin 'releases/0.1.0'
84+
git tag 'release/0.1.0'
85+
git push origin 'release/0.1.0'
8286
```
8387

8488
## Publish this doc as a Gist

0 commit comments

Comments
 (0)