33 push :
44 pull_request_target :
55 types : [labeled]
6+
7+ env :
8+ JAVA_VERSION : 25
9+
610jobs :
711 build :
812 name : Build and Test
913 runs-on : ubuntu-latest
14+ permissions :
15+ contents : read
16+ id-token : write # OIDC token for the attestations step
17+ attestations : write # Required for the attestations step
18+ outputs :
19+ sha256 : ${{ steps.checksums.outputs.sha256 }}
1020 steps :
11- - uses : actions/checkout@v4
21+ - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1222 with :
13- fetch-depth : 0
14- - uses : actions/setup-java@v4
23+ fetch-depth : 0 # deep fetch for better sonarcloud analysis
24+ - uses : actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
1525 with :
16- java-version : 23
1726 distribution : ' temurin'
27+ java-version : ${{ env.JAVA_VERSION }}
1828 cache : ' maven'
1929 - name : Cache SonarCloud packages
20- uses : actions/cache@v4
30+ uses : actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
2131 with :
2232 path : ~/.sonar/cache
2333 key : ${{ runner.os }}-sonar
2636 if : startsWith(github.ref, 'refs/tags/')
2737 run : ./mvnw versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
2838 - name : Build and Test
29- id : buildAndTest
3039 run : >
31- ./mvnw -B verify
40+ ./mvnw -B verify --no-transfer-progress
3241 jacoco:report
3342 org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
3443 -Pcoverage
@@ -38,14 +47,121 @@ jobs:
3847 env :
3948 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
4049 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
41- - uses : actions/upload-artifact@v4
50+ - name : Calculate Checksums
51+ id : checksums
52+ run : |
53+ {
54+ echo 'sha256<<EOF'
55+ shasum -a256 target/*.jar
56+ echo EOF
57+ } >> $GITHUB_OUTPUT
58+ - name : Attest
59+ if : startsWith(github.ref, 'refs/tags/')
60+ uses : actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0
61+ with :
62+ subject-path : |
63+ target/*.jar
64+ target/*.pom
65+ - uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
4266 with :
4367 name : artifacts
4468 path : target/*.jar
45- - name : Create Release
46- uses : softprops/action-gh-release@v2
69+
70+ deploy-central :
71+ name : Deploy to Maven Central
72+ runs-on : ubuntu-latest
73+ permissions :
74+ id-token : write # OIDC token for sigstore signing
75+ contents : read # Required for sigstore signing
76+ needs : [build]
77+ if : github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]'))
78+ steps :
79+ - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
80+ - uses : actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
81+ with :
82+ distribution : ' temurin'
83+ java-version : ${{ env.JAVA_VERSION }}
84+ cache : ' maven'
85+ server-id : central
86+ server-username : MAVEN_CENTRAL_USERNAME
87+ server-password : MAVEN_CENTRAL_PASSWORD
88+ - name : Enforce to use tagged version
4789 if : startsWith(github.ref, 'refs/tags/')
90+ run : ./mvnw versions:set -B -DnewVersion="${GITHUB_REF##*/}"
91+ - name : Verify project version is -SNAPSHOT
92+ if : startsWith(github.ref, 'refs/tags/') == false
93+ run : |
94+ PROJECT_VERSION=$(./mvnw help:evaluate "-Dexpression=project.version" -q -DforceStdout)
95+ test "${PROJECT_VERSION: -9}" = "-SNAPSHOT"
96+ - name : Deploy to Maven Central
97+ run : ./mvnw deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
98+ env :
99+ MAVEN_CENTRAL_USERNAME : ${{ secrets.MAVEN_CENTRAL_USERNAME }}
100+ MAVEN_CENTRAL_PASSWORD : ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
101+ MAVEN_GPG_PASSPHRASE : ${{ secrets.RELEASES_GPG_PASSPHRASE }}
102+ MAVEN_GPG_KEY : ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
103+ MAVEN_GPG_KEY_FINGERPRINT : ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
104+
105+ deploy-github :
106+ name : Deploy to GitHub Packages
107+ runs-on : ubuntu-latest
108+ permissions :
109+ packages : write # Required for the deploy to GitHub Packages step
110+ id-token : write # OIDC token for sigstore signing
111+ contents : read # Required for sigstore signing
112+ needs : [build]
113+ if : github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]'))
114+ steps :
115+ - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
116+ - uses : actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
117+ with :
118+ java-version : ${{ env.JAVA_VERSION }}
119+ distribution : ' temurin'
120+ cache : ' maven'
121+ - name : Enforce to use tagged version
122+ if : startsWith(github.ref, 'refs/tags/')
123+ run : ./mvnw versions:set -B -DnewVersion="${GITHUB_REF##*/}"
124+ - name : Verify project version is -SNAPSHOT
125+ if : startsWith(github.ref, 'refs/tags/') == false
126+ run : |
127+ PROJECT_VERSION=$(./mvnw help:evaluate "-Dexpression=project.version" -q -DforceStdout)
128+ test "${PROJECT_VERSION: -9}" = "-SNAPSHOT"
129+ - name : Deploy to GitHub Packages
130+ run : ./mvnw deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress
131+ env :
132+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
133+ MAVEN_GPG_PASSPHRASE : ${{ secrets.RELEASES_GPG_PASSPHRASE }}
134+ MAVEN_GPG_KEY : ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
135+ MAVEN_GPG_KEY_FINGERPRINT : ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
136+
137+ release :
138+ name : Release
139+ runs-on : ubuntu-latest
140+ permissions :
141+ contents : write # Required for the release step
142+ needs : [build, deploy-central, deploy-github]
143+ if : startsWith(github.ref, 'refs/tags/')
144+ steps :
145+ - name : Create Release
146+ uses : softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
48147 with :
49148 prerelease : true
50149 token : ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
51150 generate_release_notes : true
151+ body : |-
152+ ### Changelog
153+ For a list of all notable changes, read the [changelog](/CHANGELOG.md).
154+
155+ ### Maven Coordinates
156+ ```xml
157+ <dependency>
158+ <groupId>org.cryptomator</groupId>
159+ <artifactId>cryptolib</artifactId>
160+ <version>${{ github.ref_name }}</version>
161+ </dependency>
162+ ```
163+
164+ ### Artifact Checksums
165+ ```txt
166+ ${{ needs.build.outputs.sha256 }}
167+ ```
0 commit comments