Skip to content

Commit 69e58cb

Browse files
publish & consume SNAPSHOT versions
1 parent 96ad2b9 commit 69e58cb

File tree

4 files changed

+99
-67
lines changed

4 files changed

+99
-67
lines changed

.github/workflows/build.yml

Lines changed: 84 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,110 @@
11
name: Build
22
on:
33
push:
4+
pull_request_target:
5+
types: [labeled]
6+
7+
env:
8+
JAVA_VERSION: 25
49

510
jobs:
611
build:
712
name: Build and Test
813
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write # Required for the attestations step
16+
attestations: write # Required for the attestations step
917
steps:
1018
- uses: actions/checkout@v5
1119
- uses: actions/setup-java@v5
1220
with:
1321
distribution: 'temurin'
14-
java-version: 25
22+
java-version: ${{ env.JAVA_VERSION }}
1523
cache: 'maven'
1624
- name: Ensure to use tagged version
1725
if: startsWith(github.ref, 'refs/tags/')
18-
shell: bash
19-
run: |
20-
mvn -B versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
26+
run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
2127
- name: Build and Test
22-
id: buildAndTest
23-
run: mvn -B clean verify
28+
run: mvn -B verify --no-transfer-progress
29+
- name: Attest
30+
if: startsWith(github.ref, 'refs/tags/')
31+
uses: actions/attest-build-provenance@v3
32+
with:
33+
subject-path: |
34+
target/*.jar
35+
target/*.pom
2436
- uses: actions/upload-artifact@v5
2537
with:
2638
name: artifacts
2739
path: target/*.jar
40+
41+
deploy-central:
42+
name: Deploy to Maven Central
43+
runs-on: ubuntu-latest
44+
permissions: {}
45+
needs: [build]
46+
if: github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]'))
47+
steps:
48+
- uses: actions/checkout@v5
49+
- uses: actions/setup-java@v5
50+
with:
51+
distribution: 'temurin'
52+
java-version: ${{ env.JAVA_VERSION }}
53+
cache: 'maven'
54+
server-id: central
55+
server-username: MAVEN_CENTRAL_USERNAME
56+
server-password: MAVEN_CENTRAL_PASSWORD
57+
- name: Verify project version matches tag
58+
if: startsWith(github.ref, 'refs/tags/')
59+
run: |
60+
PROJECT_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)
61+
test "$PROJECT_VERSION" = "${GITHUB_REF##*/}"
62+
- name: Deploy to Maven Central
63+
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
64+
env:
65+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
66+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
67+
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
68+
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
69+
MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
70+
71+
deploy-github:
72+
name: Deploy to GitHub Packages
73+
runs-on: ubuntu-latest
74+
permissions:
75+
packages: write # Required for the deploy to GitHub Packages step
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@v5
80+
- uses: actions/setup-java@v5
81+
with:
82+
java-version: ${{ env.JAVA_VERSION }}
83+
distribution: 'temurin'
84+
cache: 'maven'
85+
- name: Verify project version matches tag
86+
if: startsWith(github.ref, 'refs/tags/')
87+
run: |
88+
PROJECT_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)
89+
test "$PROJECT_VERSION" = "${GITHUB_REF##*/}"
90+
- name: Deploy to GitHub Packages
91+
run: mvn deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
95+
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
96+
MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
97+
98+
release:
99+
name: Release
100+
runs-on: ubuntu-latest
101+
permissions:
102+
contents: write # Required for the release step
103+
needs: [deploy-central, deploy-github]
104+
if: startsWith(github.ref, 'refs/tags/')
105+
steps:
28106
- name: Create Release
29107
uses: softprops/action-gh-release@v2
30-
if: startsWith(github.ref, 'refs/tags/')
31108
with:
32109
prerelease: true
33110
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}

.github/workflows/publish-central.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/publish-github.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

pom.xml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
<!-- runtime dependencies -->
4242

43-
<api.version>1.7.0</api.version>
43+
<api.version>1.8.0-SNAPSHOT</api.version>
4444
<secret-service.version>2.0.1-alpha</secret-service.version>
4545
<kdewallet.version>1.4.0</kdewallet.version>
4646
<slf4j.version>2.0.17</slf4j.version>
@@ -61,6 +61,20 @@
6161
<central-publishing.version>0.9.0</central-publishing.version>
6262
</properties>
6363

64+
<repositories>
65+
<repository>
66+
<name>Central Portal Snapshots</name>
67+
<id>central-portal-snapshots</id>
68+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
69+
<releases>
70+
<enabled>false</enabled>
71+
</releases>
72+
<snapshots>
73+
<enabled>true</enabled>
74+
</snapshots>
75+
</repository>
76+
</repositories>
77+
6478
<dependencies>
6579
<dependency>
6680
<groupId>org.cryptomator</groupId>

0 commit comments

Comments
 (0)