-
Notifications
You must be signed in to change notification settings - Fork 179
74 lines (73 loc) · 2.79 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
name: Release New Version
run-name: Release version ${{github.event.inputs.release_version}}
on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version (MAJOR.MINOR.PATCH, eg. 2.3.4)'
required: true
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Validation for release version
run: |
echo "Validating that release version ${{ github.event.inputs.release_version }} is a version in the correct format according to semver (MAJOR.MINOR.PATCH)"
echo "${{ github.event.inputs.release_version }}" | grep -P '^2\.[0-9]+\.[0-9]+$'
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- run: |
echo "Release version ${{ github.event.inputs.release_version }}!"
- name: Set projects Maven version to GitHub Action GUI set version
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.release_version }}"
# - name: Deploy to Github packages
# run: mvn --batch-mode clean deploy -Pgithub
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
- name: Set projects Maven version to GitHub Action GUI set version
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.release_version }}"
- name: Publish to the Maven Central Repository
run: mvn --batch-mode clean deploy -Possrh
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Generate changelog
id: changelog
uses: metcalfc/[email protected]
with:
mytoken: "${{ secrets.GITHUB_TOKEN }}"
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.release_version }}
release_name: ${{ github.event.inputs.release_version }}
body: |
### Things that changed in this release
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false
call_pom_update:
needs: publish
uses: ./.github/workflows/pom_update.yml