-
Notifications
You must be signed in to change notification settings - Fork 18
57 lines (55 loc) · 2.31 KB
/
release.yaml
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
# Inspired from https://foojay.io/today/how-to-release-a-java-module-with-jreleaser-to-maven-central-with-github-actions/
name: Publish a new release
on:
workflow_dispatch:
inputs:
previousVersion:
description: 'Previous version'
required: true
version:
description: 'Release version'
required: true
nextVersion:
description: 'Next version after release (-SNAPSHOT will be added automatically)'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Java setup
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Run a build of the code base before release
run: ./mvnw --batch-mode --no-transfer-progress clean install
- name: Set release version
run: ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${{ github.event.inputs.version }}
- name: Commit & Push changes
uses: actions-js/push@v1.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: "chore: releasing version ${{ github.event.inputs.version }}"
- name: Release with JReleaser
env:
JRELEASER_TAG_NAME: ${{ github.event.inputs.version }}
JRELEASER_PREVIOUS_TAG_NAME: ${{ github.event.inputs.previousVersion }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_NEXUS2_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }}
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./release.sh
- name: Set the next release version
run: ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${{ github.event.inputs.nextVersion }}-SNAPSHOT
- name: Commit & Push changes
uses: actions-js/push@v1.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: "chore: setting version ${{ github.event.inputs.nextVersion }}-SNAPSHOT"