Skip to content

Commit 853ed8d

Browse files
runningcodeclaude
andcommitted
Automate release publishing via GitHub Actions
Add a release workflow triggered on tag push that publishes to Maven Central, Gradle Plugin Portal, and creates a GitHub Release. Simplify CI snapshot publishing to use a single vanniktech publishToMavenCentral task and pass secrets via env vars instead of -P flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0a47b96 commit 853ed8d

3 files changed

Lines changed: 53 additions & 15 deletions

File tree

.github/workflows/gradle-build.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ jobs:
1616
name: Setup Gradle
1717
- name: Check Fladle
1818
run: ./gradlew assembleDebug assembleDebugAndroidTest printYml check :fladle-plugin:check
19-
- name: Publish Marker Snapshot
19+
- name: Publish Snapshot
2020
if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}
21-
run: ./gradlew :fladle-plugin:publishFladlePluginMarkerMavenPublicationToMavenCentralRepository :fladle-plugin:publishFulladlePluginMarkerMavenPublicationToMavenCentralRepository -Pfladle.releaseMode -PmavenCentralUsername=${{ secrets.SONATYPE_USERNAME }} -PmavenCentralPassword=${{ secrets.SONATYPE_PASSWORD }}
22-
- name: Publish Plugin Snapshot
23-
if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}
24-
run: ./gradlew :fladle-plugin:publishPluginMavenPublicationToMavenCentralRepository -Pfladle.releaseMode -PmavenCentralUsername=${{ secrets.SONATYPE_USERNAME }} -PmavenCentralPassword=${{ secrets.SONATYPE_PASSWORD }}
21+
env:
22+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
23+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
24+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }}
25+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }}
26+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
27+
run: ./gradlew :fladle-plugin:publishToMavenCentral --no-configuration-cache
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Release"
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
workflow_dispatch:
7+
8+
jobs:
9+
release:
10+
name: "Publish Release"
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@v6
16+
- uses: actions/setup-java@v5
17+
with:
18+
java-version: "17"
19+
distribution: "temurin"
20+
- uses: gradle/actions/setup-gradle@v5
21+
- name: Publish to Maven Central
22+
env:
23+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
24+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
25+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }}
26+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }}
27+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
28+
run: ./gradlew :fladle-plugin:publishToMavenCentral --no-configuration-cache
29+
- name: Publish to Gradle Plugin Portal
30+
env:
31+
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
32+
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
33+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }}
34+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }}
35+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
36+
run: ./gradlew :fladle-plugin:publishPlugins
37+
- name: Create GitHub Release
38+
env:
39+
GH_TOKEN: ${{ github.token }}
40+
run: gh release create "${{ github.ref_name }}" --generate-notes

docs/releasing.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,11 @@ git tag v{{ fladle.next_release }}
3636
git push origin v{{ fladle.next_release }}
3737
```
3838

39-
* Upload to Maven Central (this must run in three separate commands since they are from three different namespaces)
40-
``` bash
41-
./gradlew :fladle-plugin:publishFladlePluginMarkerMavenPublicationToMavenCentralRepository -Pfladle.release
42-
./gradlew :fladle-plugin:publishFulladlePluginMarkerMavenPublicationToMavenCentralRepository -Pfladle.release
43-
./gradlew :fladle-plugin:publishPluginMavenPublicationToMavenCentralRepository -Pfladle.release
44-
```
45-
* Upload to Gradle Plugin Portal
46-
```bash
47-
./gradlew :fladle-plugin:publishPlugins -Pfladle.releaseMode -Dorg.gradle.internal.publish.checksums.insecure=true
48-
```
39+
Pushing the tag automatically triggers the [release workflow](https://github.com/runningcode/fladle/actions/workflows/gradle-release.yml) which:
40+
41+
1. Publishes to Maven Central
42+
2. Publishes to Gradle Plugin Portal
43+
3. Creates a GitHub Release with auto-generated notes
4944

5045
* Release to Maven Central
5146
* Login to Maven Central Repository: [https://central.sonatype.com/](https://central.sonatype.com/)

0 commit comments

Comments
 (0)