1+ name : " Create release"
2+
3+ on :
4+ workflow_dispatch :
5+
6+ env :
7+ VERSION_FILE : gradle.properties
8+ VERSION_PATTERN : ' (?<=version=).+'
9+
10+ jobs :
11+ version :
12+ runs-on : ubuntu-latest
13+ outputs :
14+ CURRENT_VERSION : ${{ steps.versions.outputs.CURRENT_VERSION }}
15+ NEXT_VERSION : ${{ steps.versions.outputs.NEXT_VERSION }}
16+ RELEASE_VERSION : ${{ steps.versions.outputs.RELEASE_VERSION }}
17+ steps :
18+ - name : ' Checkout Repository'
19+ uses : actions/checkout@v3
20+ - name : Get version
21+ id : versions
22+ uses : HardNorth/github-version-generate@v1.3.0
23+ with :
24+ version-source : file
25+ version-file : ${{ env.VERSION_FILE }}
26+ version-file-extraction-pattern : ${{ env.VERSION_PATTERN }}
27+ publish_artifacts :
28+ needs :
29+ - version
30+ runs-on : macos-latest
31+ steps :
32+ - name : ' Checkout Repository'
33+ uses : actions/checkout@v3
34+ - uses : actions/setup-java@v3
35+ with :
36+ distribution : temurin
37+ java-version-file : .ci-java-version
38+ - name : Validate Gradle Wrapper
39+ uses : gradle/wrapper-validation-action@v1.0.6
40+ - name : Cache konan
41+ uses : actions/cache@v3.3.1
42+ with :
43+ path : ~/.konan
44+ key : ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
45+ restore-keys : |
46+ ${{ runner.os }}-gradle-
47+ - name : Build with Gradle
48+ uses : gradle/gradle-build-action@v2.6.0
49+ env :
50+ SIGNING_KEY_ID : ${{ secrets.SIGNING_KEY_ID }}
51+ SIGNING_PASSWORD : ${{ secrets.SIGNING_PASSWORD }}
52+ SIGNING_SECRET_KEY : ${{ secrets.SIGNING_SECRET_KEY }}
53+ OSSRH_USERNAME : ${{ secrets.OSSRH_USERNAME }}
54+ OSSRH_PASSWORD : ${{ secrets.OSSRH_PASSWORD }}
55+ with :
56+ gradle-version : wrapper
57+ arguments : |
58+ --no-daemon
59+ build
60+ publish
61+ closeAndReleaseStagingRepository
62+ -Pversion=${{ needs.version.outputs.RELEASE_VERSION }}
63+ create_release :
64+ runs-on : ubuntu-latest
65+ needs :
66+ - publish_artifacts
67+ - version
68+ steps :
69+ - name : ' Checkout Repository'
70+ uses : actions/checkout@v3
71+ - name : Store SHA of HEAD commit on ENV
72+ run : echo "GIT_HEAD=$(git rev-parse HEAD)" >> $GITHUB_ENV
73+
74+ - name : Create tag
75+ id : create_tag
76+ uses : actions/github-script@v6
77+ with :
78+ github-token : ${{ secrets.PUSH_PAT }}
79+ script : |
80+ const {GIT_HEAD} = process.env
81+ github.rest.git.createRef({
82+ owner: context.repo.owner,
83+ repo: context.repo.repo,
84+ ref: "refs/tags/${{ needs.version.outputs.RELEASE_VERSION }}",
85+ sha: `${GIT_HEAD}`
86+ })
87+
88+ - name : Build changelog
89+ id : build_changelog
90+ uses : mikepenz/release-changelog-builder-action@v4
91+ with :
92+ configuration : changelog_config.json
93+ toTag : ${{ needs.version.outputs.RELEASE_VERSION }}
94+ env :
95+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
96+ - name : Create release
97+ id : create_release
98+ uses : ncipollo/release-action@v1.12.0
99+ with :
100+ body : ${{ steps.build_changelog.outputs.changelog }}
101+ name : Release ${{ needs.version.outputs.RELEASE_VERSION }}
102+ tag : ${{ needs.version.outputs.RELEASE_VERSION }}
103+ token : ${{ secrets.PUSH_PAT }}
0 commit comments