-
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (86 loc) · 3.43 KB
/
build.yaml
File metadata and controls
102 lines (86 loc) · 3.43 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: "Build"
on:
push:
branches: [ "**" ]
tags-ignore: [ "**" ]
pull_request:
release:
types: [ released, prereleased ]
concurrency:
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
cancel-in-progress: true
env:
ORG_GRADLE_PROJECT_release: ${{ github.event_name == 'release' }}
jobs:
action:
name: "Action"
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: "Checkout Repository"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-tags: true
fetch-depth: 0
- name: "Checkout CI Scripts"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
repository: xpdustry/.github
path: .xpdustry-ci
sparse-checkout: scripts
- name: "Setup Java 25"
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "25"
distribution: "temurin"
- name: "Setup Gradle"
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6
- name: "Get And Validate Version"
id: version
run: |
version="$(./gradlew properties -q | grep '^version:' | cut -d ':' -f 2 | xargs)"
.xpdustry-ci/scripts/version-validate.sh "$version" "$ORG_GRADLE_PROJECT_release"
echo "version=${version%-SNAPSHOT}" >> "$GITHUB_OUTPUT"
- name: "Build Gradle"
run: ./gradlew build dist
- name: "Upload Artifacts"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: artifacts
path: "build/tmp/dist/*.jar"
if-no-files-found: error
- name: "Upload Build Results"
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: build-results
path: |
**/build/test-results/test/TEST-*.xml
**/build/reports/
- name: "Publish to GitHub"
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3
with:
files: "build/tmp/dist/*.jar"
- name: "Update Changelog"
if: ${{ github.event_name == 'release' }}
uses: stefanzweifel/changelog-updater-action@a938690fad7edf25368f37e43a1ed1b34303eb36 # v1
with:
latest-version: ${{ github.event.release.tag_name }}
release-notes: ${{ github.event.release.body }}
- name: "Bump Version"
if: ${{ github.event_name == 'release' }}
run: .xpdustry-ci/scripts/version-bump.sh "build.gradle.kts" "${{ steps.version.outputs.version }}"
- name: "Commit Release Changes"
if: ${{ github.event_name == 'release' }}
uses: planetscale/ghcommit-action@25309d8005ac7c3bcd61d3fe19b69e0fe47dbdde # v0.2.20
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: "chore(release): Post v${{ steps.version.outputs.version }} changes"
repo: ${{ github.repository }}
branch: ${{ github.event.release.target_commitish }}
file_pattern: "build.gradle.kts CHANGELOG.md"