Skip to content

Commit ff02816

Browse files
authored
update GitHub actions and release config, enable auto-releasing (#113)
1 parent 991b9c4 commit ff02816

File tree

8 files changed

+199
-97
lines changed

8 files changed

+199
-97
lines changed

.github/workflows/gradle_task.yml renamed to .github/workflows/run_gradle_task.yml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ run-name: "Gradle Task ${{ inputs.gradle-task }} @ ${{ inputs.runs-on }}"
55

66
on:
77
workflow_dispatch:
8-
98
workflow_call:
109
inputs:
1110
gradle-task:
@@ -20,12 +19,13 @@ on:
2019

2120
concurrency:
2221
# note: the Workflow inputs are also included in the concurrency group
23-
group: "${{ github.workflow }} ${{ join(inputs.*) }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
22+
group: "Gradle Task: ${{ github.workflow }} ${{ join(inputs.*) }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
2423
cancel-in-progress: true
2524

2625

2726
permissions:
2827
contents: read
28+
checks: write # required by mikepenz/action-junit-report
2929

3030

3131
jobs:
@@ -35,19 +35,21 @@ jobs:
3535
name: "./gradlew ${{ inputs.gradle-task}} @ ${{ inputs.runs-on }}"
3636
timeout-minutes: 60
3737
steps:
38+
39+
### Gradle task ###
40+
3841
- name: Checkout the repo
3942
uses: actions/checkout@v3
4043

44+
- name: Validate Gradle Wrapper
45+
uses: gradle/wrapper-validation-action@v1
46+
4147
- name: Setup JDK
4248
uses: actions/setup-java@v3
4349
with:
4450
distribution: temurin
4551
java-version: 11
4652

47-
- uses: gradle/gradle-build-action@v2
48-
with:
49-
gradle-home-cache-cleanup: true
50-
5153
- name: Cache NPM
5254
uses: actions/cache@v3
5355
env:
@@ -61,14 +63,32 @@ jobs:
6163
${{ runner.os }}-build-
6264
${{ runner.os }}-
6365
64-
- name: Run ${{ inputs.gradle-task }}
65-
run: >-
66-
./gradlew ${{ inputs.gradle-task }}
66+
- uses: gradle/gradle-build-action@v2
67+
with:
68+
gradle-home-cache-cleanup: true
69+
arguments: ${{ inputs.gradle-task }}
70+
env:
71+
ORG_GRADLE_PROJECT_sonatypeRepositoryUsername: ${{ secrets.MAVEN_SONATYPE_USERNAME }}
72+
ORG_GRADLE_PROJECT_sonatypeRepositoryPassword: ${{ secrets.MAVEN_SONATYPE_PASSWORD }}
73+
"ORG_GRADLE_PROJECT_signing.keyId": ${{ secrets.MAVEN_SONATYPE_SIGNING_KEY_ID }}
74+
"ORG_GRADLE_PROJECT_signing.key": ${{ secrets.MAVEN_SONATYPE_SIGNING_KEY }}
75+
"ORG_GRADLE_PROJECT_signing.password": ${{ secrets.MAVEN_SONATYPE_SIGNING_PASSWORD }}
6776

6877
- name: Upload build reports
6978
if: failure()
7079
uses: actions/upload-artifact@v3
7180
with:
72-
name: build-report-${{ runner.os }}-${{ github.action }}
73-
path: "**/build/reports/"
81+
name: build-report-${{ runner.os }}${{ github.action }}
82+
path: |
83+
**/build/reports/
84+
**/*.hprof
85+
**/*.log
7486
if-no-files-found: ignore
87+
88+
- name: Publish Test Reports
89+
uses: mikepenz/action-junit-report@v3
90+
if: always()
91+
with:
92+
report_paths: |
93+
**/build/test-results/**/TEST-*.xml
94+
require_tests: false
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish Maven
2+
3+
4+
on:
5+
workflow_dispatch:
6+
workflow_call:
7+
8+
9+
concurrency:
10+
group: "Publish Maven: ${{ github.workflow }}"
11+
cancel-in-progress: false
12+
13+
14+
permissions:
15+
contents: write
16+
packages: write
17+
checks: write
18+
19+
20+
jobs:
21+
22+
sonatype-release:
23+
if: github.ref == 'refs/heads/main'
24+
permissions:
25+
contents: read
26+
packages: write
27+
checks: write
28+
uses: ./.github/workflows/run_gradle_task.yml
29+
secrets: inherit
30+
with:
31+
runs-on: macos-latest # only macOS supports building all Kotlin targets
32+
gradle-task: >-
33+
publishAllPublicationsToSonatypeReleaseRepository --stacktrace --no-configuration-cache --no-parallel

.github/workflows/deploy-site.yml renamed to .github/workflows/run_publish_site.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
name: Deploy Site
1+
name: Publish Site
2+
23

34
on:
45
workflow_dispatch:
56
workflow_call:
6-
push:
7-
tags:
8-
- "v[0-9]+.[0-9]+.[0-9]+"
97

108

119
concurrency:
12-
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
10+
group: "Publish Site: ${{ github.workflow }}"
1311
cancel-in-progress: true
1412

1513

@@ -21,16 +19,15 @@ jobs:
2119
- name: Checkout the repo
2220
uses: actions/checkout@v3
2321

22+
- name: Validate Gradle Wrapper
23+
uses: gradle/wrapper-validation-action@v1
24+
2425
- name: Setup JDK
2526
uses: actions/setup-java@v3
2627
with:
2728
distribution: temurin
2829
java-version: 11
2930

30-
- uses: gradle/gradle-build-action@v2
31-
with:
32-
gradle-home-cache-cleanup: true
33-
3431
- name: Cache NPM
3532
uses: actions/cache@v3
3633
env:
@@ -45,7 +42,10 @@ jobs:
4542
${{ runner.os }}-
4643
4744
- name: docusaurus build
48-
run: ./gradlew docusaurusBuild
45+
uses: gradle/gradle-build-action@v2
46+
with:
47+
gradle-home-cache-cleanup: true
48+
arguments: docusaurusBuild
4949

5050
- uses: actions/upload-pages-artifact@v2
5151
with:
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
name: Tests
22

33
on:
4-
pull_request:
54
workflow_dispatch:
65
workflow_call:
7-
merge_group:
8-
push:
9-
branches:
10-
- "main"
11-
- "renovate/**"
126

137
concurrency:
14-
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
8+
group: "Tests: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
159
cancel-in-progress: true
1610

1711

1812
permissions:
1913
contents: read
14+
checks: write # required by mikepenz/action-junit-report
2015

2116

2217
jobs:
@@ -26,14 +21,15 @@ jobs:
2621
matrix:
2722
os: [ ubuntu-latest, macos-latest, windows-latest ]
2823
fail-fast: false
29-
uses: ./.github/workflows/gradle_task.yml
24+
uses: ./.github/workflows/run_gradle_task.yml
3025
with:
3126
runs-on: ${{ matrix.os }}
3227
gradle-task: >-
3328
check -Pkxstsgen_enableTsCompileTests=true --stacktrace
3429
3530
build-site:
36-
uses: ./.github/workflows/gradle_task.yml
31+
# verify that the site can be built, but don't deploy it
32+
uses: ./.github/workflows/run_gradle_task.yml
3733
with:
3834
runs-on: ubuntu-latest
3935
gradle-task: docusaurusBuild
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Pull Requests
2+
3+
4+
on:
5+
workflow_dispatch:
6+
pull_request:
7+
8+
9+
concurrency:
10+
group: "Pull Requests: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
11+
cancel-in-progress: true
12+
13+
14+
jobs:
15+
16+
tests:
17+
uses: ./.github/workflows/run_tests.yml
18+
permissions:
19+
contents: read
20+
checks: write
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Releases
2+
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches: [ main ]
8+
release:
9+
types: [ created ]
10+
11+
12+
concurrency:
13+
group: "Releases: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
14+
cancel-in-progress: true
15+
16+
17+
jobs:
18+
19+
tests:
20+
uses: ./.github/workflows/run_tests.yml
21+
permissions:
22+
checks: write
23+
contents: read
24+
25+
publish-maven:
26+
needs: tests
27+
if: github.ref == 'refs/heads/main'
28+
uses: ./.github/workflows/run_publish_maven.yml
29+
secrets: inherit
30+
permissions:
31+
checks: write
32+
contents: write
33+
packages: write
34+
35+
publish-site:
36+
needs: tests
37+
# only publish site when releasing
38+
if: github.ref == 'refs/heads/main' && github.event_name == 'release' && github.event.action == 'created'
39+
uses: ./.github/workflows/run_publish_site.yml
40+
permissions:
41+
checks: write
42+
contents: read
43+
id-token: write # to verify the deployment originates from an appropriate source
44+
packages: write
45+
pages: write # to deploy to Pages

buildSrc/src/main/kotlin/buildsrc/config/publishing.kt

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)