Skip to content

Commit 9a0202b

Browse files
committed
Add snapshot deploy workflow
1 parent 88d882a commit 9a0202b

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Snapshot Deploy
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Setup Java 11
16+
uses: actions/setup-java@v3
17+
with:
18+
java-version: '11'
19+
distribution: 'temurin'
20+
cache: 'maven'
21+
- name: Generate settings.xml
22+
run: |
23+
cat > ~/.m2/settings.xml << EOF
24+
<settings>
25+
<servers>
26+
<server>
27+
<id>repsy-snapshots</id>
28+
<username>${{ secrets.REPSY_USERNAME }}</username>
29+
<password>${{ secrets.REPSY_PASSWORD }}</password>
30+
</server>
31+
</servers>
32+
</settings>
33+
EOF
34+
- name: Deploy only snapshot versions
35+
run: |
36+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
37+
echo "Detected version: $VERSION"
38+
if [[ $VERSION == *"SNAPSHOT"* ]]; then
39+
echo "Deploying snapshot version: $VERSION"
40+
mvn deploy -U -B
41+
else
42+
echo "Skipping deploy for release version: $VERSION"
43+
fi
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)