-
Notifications
You must be signed in to change notification settings - Fork 10
86 lines (73 loc) · 2.6 KB
/
release.yml
File metadata and controls
86 lines (73 loc) · 2.6 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (leave empty for auto-detection based on commits)'
required: false
type: string
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
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: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Auto-detect version
id: auto
if: ${{ !inputs.version }}
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
release_branches: master
tag_prefix: ""
dry_run: true
- name: Set release tag
id: release
run: echo "tag=${{ inputs.version || steps.auto.outputs.new_tag }}" >> $GITHUB_OUTPUT
- name: Build with Gradle
run: ./gradlew build -Pversion=${{ steps.release.outputs.tag }}
- name: Publish to staging
run: ./gradlew publishAllPublicationsToStagingRepository -Pversion=${{ steps.release.outputs.tag }}
- name: Deploy with JReleaser
uses: jreleaser/release-action@v2
with:
arguments: deploy
env:
JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
JRELEASER_MAVENCENTRAL_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_PROJECT_VERSION: ${{ steps.release.outputs.tag }}
JRELEASER_PROJECT_JAVA_GROUP_ID: io.github.deblockt
- name: Create and push tag
run: |
git tag "${{ steps.release.outputs.tag }}"
git push origin "${{ steps.release.outputs.tag }}"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.release.outputs.tag }}" \
--title "${{ steps.release.outputs.tag }}" \
--generate-notes
- name: Upload JReleaser logs
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-logs
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties