Skip to content

Commit 29b41c7

Browse files
committed
Put the publish-snapshot workflow on main
1 parent 99c341e commit 29b41c7

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish Snapshot to Maven Central
2+
3+
env:
4+
HUSKY: 0
5+
6+
on:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: publish-snapshot
14+
cancel-in-progress: false
15+
16+
jobs:
17+
publish-snapshot:
18+
name: Publish SNAPSHOT to Maven Central
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v6
22+
with:
23+
fetch-depth: 0
24+
25+
- uses: ./.github/actions/setup-copilot
26+
27+
- name: Set up JDK 17
28+
uses: actions/setup-java@v5
29+
with:
30+
java-version: "17"
31+
distribution: "temurin"
32+
cache: "maven"
33+
server-id: central
34+
server-username: MAVEN_USERNAME
35+
server-password: MAVEN_PASSWORD
36+
37+
- name: Verify version is a SNAPSHOT
38+
run: |
39+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
40+
echo "Publishing version: $VERSION"
41+
if [[ "$VERSION" != *"-SNAPSHOT" ]]; then
42+
echo "ERROR: This workflow only publishes SNAPSHOT versions. Current version: $VERSION"
43+
exit 1
44+
fi
45+
echo "### Snapshot Publish" >> $GITHUB_STEP_SUMMARY
46+
echo "- **Version:** $VERSION" >> $GITHUB_STEP_SUMMARY
47+
echo "- **Repository:** Maven Central Snapshots" >> $GITHUB_STEP_SUMMARY
48+
49+
- name: Deploy Snapshot
50+
run: mvn -B deploy -DskipTests
51+
env:
52+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
53+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

0 commit comments

Comments
 (0)