-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.51 KB
/
Copy pathsnapshot.yml
File metadata and controls
50 lines (43 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Publish Snapshot
# Publishes a -SNAPSHOT build to GitHub Packages on every push to main.
# Only the starter library is deployed; the sample application is skipped
# via <maven.deploy.skip>true</maven.deploy.skip> in its POM.
#
# Consumers can resolve snapshots by adding to their build:
# repository: https://maven.pkg.github.com/patbaumgartner/embabel-workflow-visualizer
# (requires a GitHub PAT with read:packages scope)
on:
push:
branches: [main]
permissions:
contents: read
packages: write
jobs:
publish:
name: Deploy Snapshot (Java 21)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: maven
# Writes ~/.m2/settings.xml with <server id="github"> credentials
# so that mvn deploy can authenticate with GitHub Packages.
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Guard — only deploy snapshots
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ "$VERSION" != *-SNAPSHOT ]]; then
echo "::notice::Skipping deploy — '$VERSION' is not a -SNAPSHOT version."
exit 0
fi
echo "Deploying snapshot $VERSION"
- name: Deploy
run: mvn -B -DskipTests deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}