-
Notifications
You must be signed in to change notification settings - Fork 2
49 lines (49 loc) · 1.68 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'The version to release (which will also be used for the tag)'
required: true
type: string
permissions:
contents: write # To write the version change to the repository
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Update version in gradle.properties
run: |
sed -i "s/^version=.*$/version=$VERSION/" gradle.properties
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add gradle.properties
git commit -m "Set version to $VERSION"
git tag -a $VERSION -m "Release $VERSION"
./gradlew publishToSonatype --no-daemon
./gradlew :incrementVersion --no-daemon
git add gradle.properties
git commit -m "Update to next development version"
git push
git push --tags
./gradlew closeAndReleaseSonatypeStagingRepository
env:
VERSION: ${{ inputs.version }}
OSSRH_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ inputs.version }}
run: |
gh release create "$VERSION" --generate-notes