Skip to content

Commit 577bf0e

Browse files
deploy SNAPSHOTs when commit message contains
[release snapshot]
1 parent 767b088 commit 577bf0e

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

.github/workflows/publish-central.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: Publish to Maven Central
22
on:
3+
push:
34
release:
45
types: [published]
56
jobs:
67
publish:
8+
if: github.event_name == 'release' || contains(github.event.head_commit.message, '[release snapshot]')
79
runs-on: ubuntu-latest
810
steps:
911
- uses: actions/checkout@v4
@@ -16,9 +18,16 @@ jobs:
1618
server-username: MAVEN_CENTRAL_USERNAME
1719
server-password: MAVEN_CENTRAL_PASSWORD
1820
- name: Enforce project version ${{ github.event.release.tag_name }}
19-
run: mvn versions:set -B -DnewVersion="$GIT_TAG"
20-
env:
21-
GIT_TAG: ${{ github.event.release.tag_name }}
21+
if: github.event_name == 'release'
22+
run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }}
23+
- name: Verify this is a SNAPSHOT
24+
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[release snapshot]')
25+
run: |
26+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
27+
if [[ "$VERSION" != *-SNAPSHOT ]]; then
28+
echo "::error file=pom.xml,title=Not a SNAPSHOT::Project version ($VERSION) does not end with -SNAPSHOT"
29+
exit 1
30+
fi
2231
- name: Deploy
2332
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
2433
env:

.github/workflows/publish-github.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: Publish to GitHub Packages
22
on:
3+
push:
34
release:
45
types: [published]
56
jobs:
67
publish:
8+
if: github.event_name == 'release' || contains(github.event.head_commit.message, '[release snapshot]')
79
runs-on: ubuntu-latest
810
if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
911
steps:
@@ -14,7 +16,16 @@ jobs:
1416
distribution: 'temurin'
1517
cache: 'maven'
1618
- name: Enforce project version ${{ github.event.release.tag_name }}
19+
if: github.event_name == 'release'
1720
run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }}
21+
- name: Verify this is a SNAPSHOT
22+
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[release snapshot]')
23+
run: |
24+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
25+
if [[ "$VERSION" != *-SNAPSHOT ]]; then
26+
echo "::error file=pom.xml,title=Not a SNAPSHOT::Project version ($VERSION) does not end with -SNAPSHOT"
27+
exit 1
28+
fi
1829
- name: Deploy
1930
run: mvn deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress
2031
env:

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>org.cryptomator</groupId>
44
<artifactId>cryptolib</artifactId>
5-
<version>2.3.0-SNAPSHOT</version>
5+
<version>2.3.0-UVF-SNAPSHOT</version>
66
<name>Cryptomator Crypto Library</name>
77
<description>This library contains all cryptographic functions that are used by Cryptomator.</description>
88
<url>https://github.com/cryptomator/cryptolib</url>

0 commit comments

Comments
 (0)