11name : Build
2-
32on :
43 push :
54 pull_request_target :
@@ -13,18 +12,21 @@ jobs:
1312 name : Build and Test
1413 runs-on : ubuntu-latest
1514 permissions :
16- id-token : write # Required for the attestations step
15+ contents : read
16+ id-token : write # OIDC token for the attestations step
1717 attestations : write # Required for the attestations step
18- contents : write # Required for the release step
18+ artifact-metadata : write # Required for the attestations step
19+ outputs :
20+ sha256 : ${{ steps.checksums.outputs.sha256 }}
1921 steps :
2022 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2123 with :
22- fetch-depth : 0
23- show-progress : false
24+ fetch-depth : 0 # deep fetch for better sonarcloud analysis
25+ show-progress : false
2426 - uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
2527 with :
26- java-version : ${{ env.JAVA_VERSION }}
2728 distribution : ' temurin'
29+ java-version : ${{ env.JAVA_VERSION }}
2830 cache : ' maven'
2931 - name : Cache SonarCloud packages
3032 uses : actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
@@ -34,10 +36,10 @@ jobs:
3436 restore-keys : ${{ runner.os }}-sonar
3537 - name : Ensure to use tagged version
3638 if : startsWith(github.ref, 'refs/tags/')
37- run : mvn -B versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
39+ run : ./mvnw versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
3840 - name : Build and Test
3941 run : >
40- mvn -B verify
42+ ./mvnw -B verify --no-transfer-progress
4143 jacoco:report
4244 org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
4345 -Pcoverage
@@ -47,23 +49,123 @@ jobs:
4749 env :
4850 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
4951 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
52+ - name : Calculate Checksums
53+ id : checksums
54+ run : |
55+ {
56+ echo 'sha256<<EOF'
57+ shasum -a256 target/*.jar
58+ echo EOF
59+ } >> $GITHUB_OUTPUT
5060 - name : Attest
5161 if : startsWith(github.ref, 'refs/tags/')
52- uses : actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2 .0
62+ uses : actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1 .0
5363 with :
5464 subject-path : |
5565 target/*.jar
5666 target/*.pom
57- - uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 .0.0
67+ - uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 .0.0
5868 with :
5969 name : artifacts
60- path : target/*.jar
61- - name : Create Release
70+ path : |
71+ target/*.jar
72+
73+
74+ deploy-central :
75+ name : Deploy to Maven Central
76+ runs-on : ubuntu-latest
77+ permissions :
78+ id-token : write # OIDC token for sigstore signing
79+ contents : read # Required for sigstore signing
80+ needs : [build]
81+ if : github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]'))
82+ steps :
83+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
84+ - uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
85+ with :
86+ distribution : ' temurin'
87+ java-version : ${{ env.JAVA_VERSION }}
88+ cache : ' maven'
89+ server-id : central
90+ server-username : MAVEN_CENTRAL_USERNAME
91+ server-password : MAVEN_CENTRAL_PASSWORD
92+ - name : Enforce to use tagged version
6293 if : startsWith(github.ref, 'refs/tags/')
94+ run : ./mvnw versions:set -B -DnewVersion="${GITHUB_REF##*/}"
95+ - name : Verify project version is -SNAPSHOT
96+ if : startsWith(github.ref, 'refs/tags/') == false
97+ run : |
98+ PROJECT_VERSION=$(./mvnw help:evaluate "-Dexpression=project.version" -q -DforceStdout)
99+ test "${PROJECT_VERSION: -9}" = "-SNAPSHOT"
100+ - name : Deploy to Maven Central
101+ run : ./mvnw deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
102+ env :
103+ MAVEN_CENTRAL_USERNAME : ${{ secrets.MAVEN_CENTRAL_USERNAME }}
104+ MAVEN_CENTRAL_PASSWORD : ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
105+ MAVEN_GPG_PASSPHRASE : ${{ secrets.RELEASES_GPG_PASSPHRASE }}
106+ MAVEN_GPG_KEY : ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
107+ MAVEN_GPG_KEY_FINGERPRINT : ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
108+
109+ deploy-github :
110+ name : Deploy to GitHub Packages
111+ runs-on : ubuntu-latest
112+ permissions :
113+ packages : write # Required for the deploy to GitHub Packages step
114+ id-token : write # OIDC token for sigstore signing
115+ contents : read # Required for sigstore signing
116+ needs : [build]
117+ if : github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]'))
118+ steps :
119+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
120+ - uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
121+ with :
122+ java-version : ${{ env.JAVA_VERSION }}
123+ distribution : ' temurin'
124+ cache : ' maven'
125+ - name : Enforce to use tagged version
126+ if : startsWith(github.ref, 'refs/tags/')
127+ run : ./mvnw versions:set -B -DnewVersion="${GITHUB_REF##*/}"
128+ - name : Verify project version is -SNAPSHOT
129+ if : startsWith(github.ref, 'refs/tags/') == false
130+ run : |
131+ PROJECT_VERSION=$(./mvnw help:evaluate "-Dexpression=project.version" -q -DforceStdout)
132+ test "${PROJECT_VERSION: -9}" = "-SNAPSHOT"
133+ - name : Deploy to GitHub Packages
134+ run : ./mvnw deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress
135+ env :
136+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
137+ MAVEN_GPG_PASSPHRASE : ${{ secrets.RELEASES_GPG_PASSPHRASE }}
138+ MAVEN_GPG_KEY : ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
139+ MAVEN_GPG_KEY_FINGERPRINT : ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
140+
141+ release :
142+ name : Release
143+ runs-on : ubuntu-latest
144+ permissions :
145+ contents : write # Required for the release step
146+ needs : [build, deploy-central, deploy-github]
147+ if : startsWith(github.ref, 'refs/tags/')
148+ steps :
149+ - name : Create Release
63150 uses : softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
64151 with :
65152 prerelease : true
66153 token : ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
67154 generate_release_notes : true
68- body : |
155+ body : |-
156+ ### Changelog
69157 For a list of all notable changes, read the [changelog](/CHANGELOG.md).
158+
159+ ### Maven Coordinates
160+ ```xml
161+ <dependency>
162+ <groupId>org.cryptomator</groupId>
163+ <artifactId>cryptofs</artifactId>
164+ <version>${{ github.ref_name }}</version>
165+ </dependency>
166+ ```
167+
168+ ### Artifact Checksums
169+ ```txt
170+ ${{ needs.build.outputs.sha256 }}
171+ ```
0 commit comments