-
Notifications
You must be signed in to change notification settings - Fork 13
46 lines (38 loc) · 1.31 KB
/
publish.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
name: Alkaid Publish
on:
push:
branches: [ main ]
jobs:
publish:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, '#Skip')"
steps:
- uses: actions/checkout@v3
- name: Fetch commit hash
id: sha
if: "! contains(github.event.head_commit.message, '#Release')"
run: |
sha=$(git rev-parse --short ${{ github.sha }})
echo "::set-output name=short_sha::$sha"
- name: Replace publish version
if: "! contains(github.event.head_commit.message, '#Release')"
uses: Nambers/[email protected]
with:
path: ${{ github.workspace }}/build.gradle
oldString: '@{{COMMIT_SHORT_SHA}}'
newString: ${{ steps.sha.outputs.short_sha }}
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: adopt
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle (build)
run: ./gradlew build -x test
- name: Build with Gradle (publish)
run: ./gradlew publish
env:
REPOSITORY_ROOT_URL: ${{ secrets.REPOSITORY_ROOT_URL }}
REPOSITORY_USER: ${{ secrets.REPOSITORY_USER }}
REPOSITORY_TOKEN: ${{ secrets.REPOSITORY_TOKEN }}