-
Notifications
You must be signed in to change notification settings - Fork 6
159 lines (154 loc) · 5.65 KB
/
release.yml
File metadata and controls
159 lines (154 loc) · 5.65 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: "Create release"
on:
workflow_dispatch:
inputs:
skip-publication:
description: 'Skip publication of artifacts to Maven Central'
required: false
default: false
type: boolean
env:
VERSION_FILE: gradle.properties
VERSION_PATTERN: '(?<=version=).+'
jobs:
version:
runs-on: ubuntu-latest
outputs:
CURRENT_VERSION: ${{ steps.versions.outputs.CURRENT_VERSION }}
NEXT_VERSION: ${{ steps.versions.outputs.NEXT_VERSION }}
RELEASE_VERSION: ${{ steps.versions.outputs.RELEASE_VERSION }}
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v6
- name: Get version
id: versions
uses: HardNorth/github-version-generate@v1.4.0
with:
version-source: file
version-file: ${{ env.VERSION_FILE }}
version-file-extraction-pattern: ${{ env.VERSION_PATTERN }}
build-and-test:
if: github.event.inputs.skip-publication != 'true' && !cancelled()
uses: ./.github/workflows/build-and-test.yml
publish_artifacts:
# permissions required for sigstore signature
permissions:
id-token: write
contents: read
needs:
- version
- build-and-test
if: github.event.inputs.skip-publication != 'true' && !cancelled()
runs-on: macos-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v6
with:
submodules: true
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version-file: .java-version
- uses: actions/setup-python@v6
with:
python-version-file: .python-version
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v6
- name: Cache konan
uses: actions/cache@v5
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
with:
gradle-version: wrapper
- name: Build and publish release
run: >
./gradlew --no-daemon --info
:json-schema-validator:assemble
:json-schema-validator-objects:assemble
publishToMavenCentral --no-configuration-cache
-Pversion=${{ needs.version.outputs.RELEASE_VERSION }}
-x :benchmark:benchmark
env:
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_SECRET_KEY }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
create_release:
runs-on: ubuntu-latest
needs:
- publish_artifacts
- version
if: ${{ !cancelled() }}
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v6
- name: Store SHA of HEAD commit on ENV
run: echo "GIT_HEAD=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Create tag
id: create_tag
uses: actions/github-script@v9
with:
github-token: ${{ secrets.PUSH_PAT }}
script: |
const {GIT_HEAD} = process.env
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ needs.version.outputs.RELEASE_VERSION }}",
sha: `${GIT_HEAD}`
})
- name: Build changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v6
with:
configuration: changelog_config.json
toTag: ${{ needs.version.outputs.RELEASE_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: create_release
uses: ncipollo/release-action@v1.21.0
with:
body: ${{ steps.build_changelog.outputs.changelog }}
name: Release ${{ needs.version.outputs.RELEASE_VERSION }}
tag: ${{ needs.version.outputs.RELEASE_VERSION }}
token: ${{ secrets.PUSH_PAT }}
makeLatest: ${{ github.ref == 'refs/heads/main' }}
update-version:
runs-on: ubuntu-latest
if : ${{ !cancelled() }}
needs:
- create_release
- version
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v6
with:
token: ${{ secrets.PUSH_PAT }}
- name: Prepare next dev version
id: prepare_next_dev
run: |
# gradle
sed -i -e 's/${{ needs.version.outputs.CURRENT_VERSION }}/${{ needs.version.outputs.NEXT_VERSION }}/g' gradle.properties
sed -i -E -e 's/json-schema-validator((-[a-z]+)?:|\/)[0-9]+\.[0-9]+\.[0-9]+/json-schema-validator\1${{ needs.version.outputs.RELEASE_VERSION }}/g' README.md
sed -i -E -e 's/json-schema-validator((-[a-z]+)?:|\/)[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)/json-schema-validator\1${{ needs.version.outputs.NEXT_VERSION }}/g' README.md
# maven
sed -i -e 's|<version>[0-9]+\.[0-9]+\.[0-9]+|<version>${{ needs.version.outputs.RELEASE_VERSION }}|g' README.md
sed -i -e 's|<version>[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)|<version>${{ needs.version.outputs.NEXT_VERSION }}|g' README.md
- name: Show what has changed
if: ${{ !cancelled() }}
run: |
git diff
- name: Commit next dev version
id: commit_next_dev
uses: EndBug/add-and-commit@v10
with:
add: "['gradle.properties', 'README.md']"
default_author: github_actions
message: "Prepare next version"