-
-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (89 loc) · 3.66 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
name: release
on:
push:
tags:
- "**"
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=2g"
JDK_VERSION: 19
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
outputs:
module_name: ${{ steps.module.outputs.module_name }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v3
with:
java-version: ${{ env.JDK_VERSION }}
distribution: temurin
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Save tag prefix to github env
id: module
run: echo "module_name=$(echo $GITHUB_REF_NAME | cut -d'/' -f1)" >> $GITHUB_OUTPUT
- uses: gradle/gradle-build-action@v2
- name: remove SNAPSHOT suffix on kipher-core version
if: ${{ steps.module.outputs.module_name }} != "kipher-core"
run: |
cd kipher-core
sed -i '/^VERSION=/ s/-SNAPSHOT//' gradle.properties
- name: remove SNAPSHOT on gradle.properties version
run: |
cd ${{ steps.module.outputs.module_name }}
sed -i '/^VERSION=/ s/-SNAPSHOT//' gradle.properties
- name: remove SNAPSHOT on root gradle.properties
run: sed -i '/^VERSION=/ s/-SNAPSHOT//' gradle.properties
- name: Get version from gradle.properties
id: version_name
shell: bash
run: |
cd ${{ steps.module.outputs.module_name }}
echo "version=$(grep '^VERSION=' gradle.properties | cut -d'=' -f2)" >> $GITHUB_OUTPUT
- name: Gradle build
run: ./gradlew ${{ steps.module.outputs.module_name }}:clean ${{ steps.module.outputs.module_name }}:build --scan
- name: Publish module on GPR
run: ./gradlew ${{ steps.module.outputs.module_name }}:publishAllPublicationsToGitHubPackagesRepository
- name: Publish module on Sonatype
run: ./gradlew ${{ steps.module.outputs.module_name }}:publishToSonatype
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }}
- name: Publish module on Sonatype (Phase 2)
run: ./gradlew findSonatypeStagingRepository closeSonatypeStagingRepository
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }}
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
validation_level: warn
version: ${{ steps.version_name.outputs.version }}
path: docs/CHANGELOG-${{ steps.module.outputs.module_name }}.md
- name: Create release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
tag: ${{ steps.module.outputs.module_name }}/${{ steps.changelog_reader.outputs.version }}
name: ${{ steps.module.outputs.module_name }} v${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prerelease' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
allowUpdates: true
artifactErrorsFailBuild: false
artifacts: |
${{ steps.module.outputs.module_name }}/build/libs/*
docs:
needs: [ publish ]
uses: ./.github/workflows/docs.yml
with:
project: ${{ needs.publish.outputs.module_name }}
secrets: inherit