-
Notifications
You must be signed in to change notification settings - Fork 10
74 lines (69 loc) · 2.61 KB
/
build-and-deploy.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
name: Deployment (J17)
on:
push:
branches-ignore:
- master
- "**/dev**"
- "**-dev"
- "**-dev**"
- dev
jobs:
build-and-deploy:
env:
BRANCH_PREFIX: $(cat gradle.properties | grep mod_version | cut -d'+' -f2)
strategy:
matrix:
java: [17]
runs-on: ubuntu-latest
steps:
- name: check environment variables
run: env
- name: checkout repository
uses: actions/checkout@v3
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
run: ./gradlew build
- name: capture build artifacts
if: |
${{ matrix.java == '17' }}
github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/libs/
- name: get mod version and loader
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
id: mod_version
run: |
loader_val=$(grep "loader" gradle.properties | cut -d'=' -f2 | tr -d '\n')
mod_version_val=$(grep "mod_version" gradle.properties | cut -d'=' -f2 | tr -d '\n')
echo "mod_version=$mod_version_val-$loader_val" >> $GITHUB_OUTPUT
echo "commitish=$mod_version_val/$loader_val" >> $GITHUB_OUTPUT
- name: get minecraft version
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
id: minecraft_version
run: |
minecraft_version_val=$(grep "mod_version" gradle.properties | cut -d'+' -f2 | cut -d'-' -f1 | tr -d '\n')
echo "minecraft_version=$minecraft_version_val" >> $GITHUB_OUTPUT
- name: deploy with mc-publish
if: github.ref == 'refs/heads/${{ env.BRANCH_PREFIX }}'
uses: Kir-Antipov/[email protected]
with:
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
modrinth-token: "${{ secrets.MODRINTH_TOKEN }}"
github-tag: ${{ steps.mod_version.outputs.mod_version }}
github-token: ${{ secrets.REPOSITORY_TOKEN }}
github-commitish: ${{ steps.commitish.outputs.commitish }}
version: "${{ steps.outputs.mod_version }}"
changelog-file: CHANGELOG.md
game-versions: "${{ steps.minecraft_version.outputs.minecraft_version }}"
java: "${{ matrix.java }}"