-
Notifications
You must be signed in to change notification settings - Fork 39
100 lines (100 loc) · 3.52 KB
/
forge.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Build and Sign Mod (Forge)
on:
push:
paths:
- 'release_build_forge'
jobs:
build:
runs-on: ubuntu-latest
environment: Build
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'adopt'
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Read modid from gradle.properties
id: mod_id
uses: Reedyuk/read-properties@v1.0.1
with:
path: './gradle.properties'
property: 'mod_id'
- name: Read mod version from gradle.properties
id: mod_version
uses: Reedyuk/read-properties@v1.0.1
with:
path: './gradle.properties'
property: 'mod_version'
- name: Read minecraft version from gradle.properties
id: mc_version
uses: Reedyuk/read-properties@v1.0.1
with:
path: './gradle.properties'
property: 'minecraft_version'
- name: Cache
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: gradle-minecraft-${{ steps.mc_version.outputs.value }}
- name: Load Keystore
id: load_keystore
env:
JKS: ${{ secrets.MRCRAYFISH_JKS }}
if: ${{ env.JKS != '' }}
uses: timheuer/base64-to-file@v1.2
with:
fileName: 'keystore.jks'
encodedString: ${{ env.JKS }}
- name: Set Keystore Variables
if: ${{ steps.load_keystore.outputs.filePath != '' }}
run: |
echo "KEYSTORE=${{ steps.load_keystore.outputs.filePath }}" >> $GITHUB_ENV
echo "KEYSTORE_ALIAS=${{ secrets.MRCRAYFISH_JKS_ALIAS }}" >> $GITHUB_ENV
echo "KEYSTORE_PASS=${{ secrets.MRCRAYFISH_JKS_PASSPHRASE }}" >> $GITHUB_ENV
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Run Data Gen
env:
GPR_USER: "MrCrayfish"
GPR_KEY: ${{ secrets.GPR_TOKEN }}
TARGET_LOADER: "forge"
run: ./gradlew :forge:Data
- name: Build and Publish
env:
GPR_USER: "MrCrayfish"
GPR_KEY: ${{ secrets.GPR_TOKEN }}
SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
TARGET_LOADER: "forge"
run: ./gradlew :forge:build :forge:publish
- name: Stop Gradle
run: ./gradlew --stop
- name: Construct artifact files
id: artifacts
run: |
echo "forge=forge/build/libs/${{ steps.mod_id.outputs.value }}-forge-${{ steps.mc_version.outputs.value }}-${{ steps.mod_version.outputs.value }}-signed.jar" >> "$GITHUB_OUTPUT"
- name: Import GPG
env:
SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
if: ${{ env.SIGNING_KEY != '' && env.SIGNING_PASSPHRASE != '' }}
uses: crazy-max/ghaction-import-gpg@v5.3.0
with:
gpg_private_key: ${{ env.SIGNING_KEY }}
passphrase: ${{ env.SIGNING_PASSPHRASE }}
- name: Sign JAR
env:
SIGNING_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
if: ${{ env.SIGNING_PASSPHRASE != '' }}
run: |
gpg --batch --yes --passphrase "${{ env.SIGNING_PASSPHRASE }}" --armor --detach-sign ${{ steps.artifacts.outputs.forge }}
- name: Upload Forge Artifacts
uses: actions/upload-artifact@v2
with:
name: '${{ steps.mod_id.outputs.value }}-forge-${{ steps.mc_version.outputs.value }}-${{ steps.mod_version.outputs.value }}'
path: |
${{ steps.artifacts.outputs.forge }}
${{ steps.artifacts.outputs.forge }}.asc