Repository navigation
69 lines (60 loc) · 2.56 KB
/
Copy pathsnapshot.yml
File metadata and controls
69 lines (60 loc) · 2.56 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Publish snapshot to Maven Central
# Every push to the default branch requests a snapshot of
# org.jmonkeyengine:jme3-testdata to Sonatype, using the same date based
# versioning as the releases (scripts/next-version.sh) plus the -SNAPSHOT
# qualifier: <YYYY-MM-DD>-SNAPSHOT.
#
# Contrary to the releases, no tag and no GitHub release are created, and the
# version is not numbered: a Maven snapshot can be republished, so commits of
# the day update the <YYYY-MM-DD>-SNAPSHOT version. Superseded commits are skipped.
on:
push:
branches: [master]
# Snapshot uploads share Maven metadata, so never interrupt or overlap them.
concurrency:
group: publish-testdata-snapshot
cancel-in-progress: false
permissions:
contents: read
jobs:
snapshot:
name: Publish snapshot to Sonatype
runs-on: ubuntu-latest
steps:
- name: Clone the repo
uses: actions/checkout@v4
- name: Compute the snapshot version
id: version
run: |
version="$(bash scripts/next-version.sh --snapshot)"
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Setup the java environment
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Publish the snapshot
env:
ORG_GRADLE_PROJECT_centralUsername: ${{ secrets.CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_centralPassword: ${{ secrets.CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: |
# Queued runs and manual reruns can target a superseded commit.
master_ref="$(git ls-remote --exit-code origin refs/heads/master)"
master_sha="${master_ref%%[[:space:]]*}"
if [ "${GITHUB_SHA}" != "${master_sha}" ]; then
echo "Skipping snapshot for ${GITHUB_SHA}; master is now ${master_sha}."
exit 0
fi
if [ "${ORG_GRADLE_PROJECT_centralUsername}" = "" ] || \
[ "${ORG_GRADLE_PROJECT_centralPassword}" = "" ] || \
[ "${ORG_GRADLE_PROJECT_signingKey}" = "" ] || \
[ "${ORG_GRADLE_PROJECT_signingPassword}" = "" ]; then
echo "Configure the following secrets to enable uploading to Sonatype:"
echo "CENTRAL_USERNAME, CENTRAL_PASSWORD, SIGNING_KEY, SIGNING_PASSWORD"
exit 1
fi
./gradlew publishToSonatype \
-PtestdataVersion="${{ steps.version.outputs.version }}" \
--console=plain --stacktrace