-
Notifications
You must be signed in to change notification settings - Fork 21
119 lines (114 loc) · 3.97 KB
/
Copy pathbuild-reusable.yml
File metadata and controls
119 lines (114 loc) · 3.97 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
name: Build and Release Library Reusable
on:
workflow_call:
permissions:
attestations: write
contents: write
id-token: write
packages: write
jobs:
build-library:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Change wrapper permissions
run: chmod +x pi4micronaut-utils/gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
- name: Configure Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version (nebula final)
if: github.ref == 'refs/heads/main'
working-directory: .
run: ./gradlew final
- name: Execute Gradle build with info logging
working-directory: pi4micronaut-utils
run: ./gradlew build --info
- name: Execute Gradle shadowJar
working-directory: pi4micronaut-utils
run: ./gradlew shadowJar
- name: Upload built JAR as artifact
uses: actions/upload-artifact@v4
with:
name: micronaut-jar
path: pi4micronaut-utils/build/libs/pi4micronaut-utils-*-all.jar
publish-jar:
runs-on: ubuntu-latest
needs: build-library
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Change wrapper permissions
run: chmod +x pi4micronaut-utils/gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
- name: Publish Library
working-directory: pi4micronaut-utils
env:
PORTAL_USERNAME: ${{ vars.PORTAL_USERNAME }}
PORTAL_PASSWORD: ${{ secrets.PORTAL_PASSWORD }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
run: ./gradlew clean publish --info
- name: POST to Maven
uses: fjogeleit/http-request-action@v1
with:
url: 'https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/io.github.oss-slu'
method: 'POST'
- uses: actions/attest-build-provenance@v1
with:
subject-path: 'pi4micronaut-utils/build/libs/**/*.jar'
create-release:
runs-on: ubuntu-latest
needs: [build-library, publish-jar]
defaults:
run:
working-directory: pi4micronaut-utils
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Change wrapper permissions
run: chmod +x pi4micronaut-utils/gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
- name: Read library version
id: read_version
working-directory: .
run: |
VERSION=$(./gradlew properties | grep "^version:" | awk '{print $2}')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download built JAR
uses: actions/download-artifact@v4
with:
name: micronaut-jar
path: pi4micronaut-utils/build/libs
- name: Create GitHub Release
run: |
gh release create "${{ steps.read_version.outputs.version }}" \
--verify-tag \
--generate-notes \
"pi4micronaut-utils/build/libs/pi4micronaut-utils-${{ steps.read_version.outputs.version }}-all.jar"