Repository navigation
79 lines (74 loc) · 3.16 KB
/
Copy pathrelease-please.yml
File metadata and controls
79 lines (74 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Release plumbing (DESIGN 13). Runs while the repository variable RELEASES_ENABLED is "true" (set
# since the 1.0.0 release on 2026-10-29). Merging the release pull request is the approval.
#
# On each push to main, release-please keeps a release pull request up to date (version bump and
# CHANGELOG.md from conventional commits). Merging it creates the tag and the GitHub release; the
# publish job then runs in the "maven-central" environment (its secrets, no reviewers), builds, signs and
# uploads to Maven Central through the Central Portal, and attests the jars (build provenance).
# Publishing runs in this workflow because a release created with the default token does not
# start other workflows.
name: Release
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release
cancel-in-progress: false
jobs:
release-please:
if: vars.RELEASES_ENABLED == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- id: release
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
publish:
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
runs-on: ubuntu-latest
environment: maven-central
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.release-please.outputs.tag_name }}
persist-credentials: false
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
- name: Check the tag matches the library version
run: |
version=$(grep '^version=' gradle.properties | cut -d= -f2)
grep -q "VERSION = \"${version}\"" src/main/java/me/didit/core/Version.java
test "v${version}" = "${{ needs.release-please.outputs.tag_name }}"
- name: Test
run: ./gradlew check
- name: Sign and upload to Maven Central
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_SIGNING_KEY_PASSWORD }}
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
- name: Attest the published jars
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: build/libs/*.jar