Repository navigation
56 lines (52 loc) · 1.9 KB
/
Copy pathcommitTest.yml
File metadata and controls
56 lines (52 loc) · 1.9 KB
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
name: Build Mod
on: [push, pull_request, workflow_dispatch]
permissions:
contents: write
jobs:
buildJar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up PATH
run: |
echo "${ANDROID_HOME}/build-tools/34.0.0" >> $GITHUB_PATH
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build mod jar
id: build
run: |
chmod +x ./gradlew
./gradlew deploy
find build/ -name "*.jar" -ls
JAR_PATH=$(find build/ -iname "silicon-*-v*.jar" 2>/dev/null | head -1)
echo "jar_path=${JAR_PATH}" >> $GITHUB_OUTPUT
echo "Found jar: ${JAR_PATH}"
- name: Get mod version
id: version
run: echo "mod_version=$(grep '^version:' mod.hjson | cut -d':' -f2 | tr -d ' ')" >> $GITHUB_OUTPUT
- name: Upload built jar file
uses: actions/upload-artifact@v4
with:
name: silicon-${{ steps.version.outputs.mod_version }}-v159.7
path: ${{ steps.build.outputs.jar_path }}
- name: Delete old pre-releases
if: github.event_name == 'push' && github.ref == 'refs/heads/test'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release list --repo ${{ github.repository }} --json tagName,isPrerelease \
| jq -r '.[] | select(.isPrerelease) | .tagName' \
| xargs -I {} gh release delete {} --repo ${{ github.repository }} --yes --cleanup-tag
- name: Create pre-release
if: github.event_name == 'push' && github.ref == 'refs/heads/test'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ steps.version.outputs.mod_version }}" \
--repo ${{ github.repository }} \
--title "Silicon ${{ steps.version.outputs.mod_version }}" \
--prerelease \
"${{ steps.build.outputs.jar_path }}"