-
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (86 loc) · 3.43 KB
/
Copy pathbuild.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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-tags: true
fetch-depth: 0
- name: "Checkout CI Scripts"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
repository: xpdustry/.github
path: .xpdustry-ci
sparse-checkout: scripts
- name: "Setup Java 25"
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5
with:
java-version: "25"
distribution: "temurin"
- name: "Setup Gradle"
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # 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@718ea10b132b3b2eba29c1007bb80653f286566b # 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@a6b150b81dca5dd027baa898604418eec9e11465 # v0.2.22
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"