-
Notifications
You must be signed in to change notification settings - Fork 3
95 lines (80 loc) · 2.94 KB
/
Copy pathrelease.yml
File metadata and controls
95 lines (80 loc) · 2.94 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
name: Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version to release (must match gradle.properties, e.g. 0.2.0)"
required: true
type: string
permissions:
contents: read
jobs:
verify:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.resolve.outputs.version }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.release.tag_name || github.ref }}
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- uses: gradle/actions/setup-gradle@v6
- name: Resolve & validate version
id: resolve
run: |
RAW="${{ github.event.release.tag_name || inputs.version }}"
VERSION="${RAW#v}"
PROP=$(grep '^version=' gradle.properties | cut -d= -f2 | tr -d '[:space:]')
if [ "$VERSION" != "$PROP" ]; then
echo "::error::Release version ($VERSION) does not match gradle.properties ($PROP)"
exit 1
fi
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Version '$VERSION' is not X.Y.Z"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build + integration tests
run: ./gradlew -Prelease build :integration-tests:test --stacktrace
publish-maven-central:
needs: verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.release.tag_name || github.ref }}
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- uses: gradle/actions/setup-gradle@v6
- name: Publish to Maven Central
run: ./gradlew -Prelease publishToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_IN_MEMORY_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }}
publish-gradle-plugin-portal:
needs: verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.release.tag_name || github.ref }}
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- uses: gradle/actions/setup-gradle@v6
- name: Publish to Gradle Plugin Portal
run: ./gradlew -Prelease :korro-gradle-plugin:publishPlugins --no-configuration-cache
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}