-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (61 loc) · 2.45 KB
/
auto-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
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: auto-release
on:
push:
tags:
- 'v*'
jobs:
first:
name: Check release tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
prop() { grep -P "^\s*[^#]?${1}=.*$" './gradle.properties' | cut -d'=' -f2; }
echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "MOD_VERSION=`echo $(prop "mod_version")`" >> $GITHUB_ENV
- run: if [ "${{env.GIT_TAG}}" != "v${{env.MOD_VERSION}}" ];then exit 1;fi
second:
name: Build and publish
runs-on: ubuntu-latest
needs: first
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
architecture: 'x64'
cache: 'gradle'
- name: Build and publish with Gradle
env:
IS_RELEASE: true
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
ORG_GRADLE_PROJECT_signingKey: ${{secrets.RELEASE_SIGNING_GPG_PRIVATE_KEY}}
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.RELEASE_SIGNING_GPG_PASSPHRASE}}
AUIOC_MAVEN_USERNAME: ${{secrets.AUIOC_MAVEN_USERNAME}}
AUIOC_MAVEN_TOKEN: ${{secrets.AUIOC_MAVEN_TOKEN}}
run: |
chmod +x ./gradlew
./gradlew runData
./gradlew build publish generateUpdateJson
mkdir ./pages
cp -r ./build/tmp/update/. ./pages/
- name: Update update JSON
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: false
target-folder: update
branch: gh-pages
folder: pages
- name: Github release
uses: softprops/action-gh-release@v1
with:
files: |
build/libs/*.jar
build/libs/*.asc