-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (56 loc) · 2.15 KB
/
publish_library.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
58
59
60
61
62
63
64
65
66
67
# Remember to give this permission to your workflows in repository settings: https://stackoverflow.com/a/72992289
name: Publish Library
on:
workflow_dispatch:
inputs:
versionName:
description: 'Version Name (e.g. 1.0.3 or 1.0.3-SNAPSHOT)'
required: true
permissions:
contents: write
jobs:
publish_library:
name: Publish Library on Maven Central
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Grant Permission to Execute Gradle
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew build
- name: Publish Library
run: |
echo "Publishing and Releasing library 🚀"
./gradlew publish
echo "Published and Released ✅"
env:
ORG_GRADLE_PROJECT_VERSION_NAME: ${{ github.event.inputs.versionName }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }}
- name: Create and push tag
run: |
git config --global user.email "[email protected]"
git config --global user.name "$GITHUB_ACTOR"
git tag -a $TAG -m "Release v$TAG"
git push origin $TAG
env:
TAG: ${{ github.event.inputs.versionName }}
- name: Create Release on GitHub
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.versionName }}
name: ${{ github.event.inputs.versionName }}
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}