-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 2.48 KB
/
Copy pathrelease.yml
File metadata and controls
70 lines (59 loc) · 2.48 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
70
name: Release
on:
push:
branches: [master]
workflow_dispatch:
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
name: Publish to reposilite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Read the version being built
id: version
run: |
version=$(grep -oP '^version = "\K[^"]+' build.gradle.kts)
echo "value=$version" >> "$GITHUB_OUTPUT"
echo "building $version"
# A push that does not bump the version must not overwrite a release
# someone is already resolving. Bump build.gradle.kts to publish.
- name: Skip if this version is already published
id: exists
run: |
url=https://reposilite.atlasengine.ca/public/ca/atlasengine/pathfinding
jar=$url/${{ steps.version.outputs.value }}/pathfinding-${{ steps.version.outputs.value }}.jar
code=$(curl -s -o /dev/null -w '%{http_code}' "$jar")
echo "published=$([ "$code" = "200" ] && echo yes || echo no)" >> "$GITHUB_OUTPUT"
echo "$jar -> HTTP $code"
- name: Build and test
if: steps.exists.outputs.published == 'no'
run: ./gradlew build test --no-daemon --stacktrace
- name: Publish
if: steps.exists.outputs.published == 'no'
env:
ORG_GRADLE_PROJECT_AtlasEngineUsername: ${{ secrets.REPOSILITE_USERNAME }}
ORG_GRADLE_PROJECT_AtlasEnginePassword: ${{ secrets.REPOSILITE_PASSWORD }}
run: ./gradlew publishMavenPublicationToAtlasEngineRepository --no-daemon
- name: Verify the published artifact resolves
if: steps.exists.outputs.published == 'no'
run: |
url=https://reposilite.atlasengine.ca/public/ca/atlasengine/pathfinding/${{ steps.version.outputs.value }}
for f in .jar .pom -sources.jar -javadoc.jar; do
name=pathfinding-${{ steps.version.outputs.value }}$f
code=$(curl -s -o /dev/null -w '%{http_code}' "$url/$name")
echo "$name -> HTTP $code"
[ "$code" = "200" ] || exit 1
done
- name: Already published, nothing to do
if: steps.exists.outputs.published == 'yes'
run: echo "${{ steps.version.outputs.value }} is already on reposilite; bump the version to release."