-
Notifications
You must be signed in to change notification settings - Fork 3
108 lines (103 loc) · 3.44 KB
/
release.yml
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
name: "Create release"
on:
push: # will be removed after test
branches:
- issue_#1
# workflow_dispatch:
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@v3
- name: Get version
id: versions
uses: HardNorth/[email protected]
with:
version-source: file
version-file: ${{ env.VERSION_FILE }}
version-file-extraction-pattern: ${{ env.VERSION_PATTERN }}
publish_artifacts:
needs:
- version
runs-on: macos-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version-file: .ci-java-version
- name: Validate Gradle Wrapper
uses: gradle/[email protected]
- name: Cache konan
uses: actions/[email protected]
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
uses: gradle/[email protected]
env:
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
with:
gradle-version: wrapper
# should close and release staging repository
arguments: |
--no-daemon
build
publish
closeSonatypeStagingRepository
-Pversion=${{ needs.version.outputs.RELEASE_VERSION }}
create_release:
runs-on: ubuntu-latest
needs:
- publish_artifacts
- version
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- 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@v6
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@v4
with:
configurationJson: changelog_config.json
toTag: ${{ needs.version.outputs.RELEASE_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: create_release
uses: ncipollo/[email protected]
with:
body: ${{ steps.build_changelog.outputs.changelog }}
draft: true
name: Release ${{ needs.version.outputs.RELEASE_VERSION }}
tag: ${{ needs.version.outputs.RELEASE_VERSION }}
token: ${{ secrets.PUSH_PAT }}