-
-
Notifications
You must be signed in to change notification settings - Fork 43
123 lines (104 loc) · 5.22 KB
/
publish-branch.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: "Publish branch"
on:
workflow_call:
inputs:
mod_loaders:
description: 'List of mod loaders to be published'
required: true
type: string
branch:
description: "Branch to be published"
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
name: Build ${{ inputs.branch }}
timeout-minutes: 30
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
fetch-depth: 0
- name: "Parse gradle properties"
id: gradle-properties
run: ./.github/scripts/parse-gradle-properties.sh
- name: "Parse changelog"
run: ./.github/scripts/parse-changelog.sh ${{ steps.gradle-properties.outputs.MOD_VERSION }}
- name: "Create github release"
continue-on-error: true
uses: ncipollo/release-action@v1
with:
skipIfReleaseExists: true
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
tag: mc${{ steps.gradle-properties.outputs.MINECRAFT_VERSION }}-${{ steps.gradle-properties.outputs.MOD_VERSION }}
commit: ${{ inputs.branch }}
name: ${{ steps.gradle-properties.outputs.MOD_NAME }} ${{ steps.gradle-properties.outputs.MOD_VERSION }} for Minecraft ${{ steps.gradle-properties.outputs.MINECRAFT_VERSION }}
bodyFile: RELEASE_CHANGELOG.md
- name: "Set up JDK"
uses: actions/setup-java@v4
with:
java-version: ${{ steps.gradle-properties.outputs.MOD_JAVA_VERSION }}
distribution: temurin
- name: "Setup Gradle and run build"
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false
generate-job-summary: false
gradle-version: wrapper
arguments: build
- name: "Upload Built JARs"
uses: actions/upload-artifact@v4
with:
name: built-jars-${{ inputs.branch }}
if-no-files-found: error
path: |
./**/build/libs/*[0-9].jar
- name: "Generate matrix for the run job"
id: set-matrix
run: ./.github/scripts/generate-publish-matrix.sh "${{ inputs.mod_loaders }}" ${{ vars.CURSEFORGE_FABRIC_PROJECT_ID }} ${{ vars.CURSEFORGE_FORGE_PROJECT_ID }} ${{ vars.MODRINTH_FABRIC_PROJECT_ID }} ${{ vars.MODRINTH_FORGE_PROJECT_ID }}
publish:
runs-on: ubuntu-latest
needs: build
name: Publish ${{ inputs.branch }} ${{ matrix.mod_loader }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build.outputs.matrix)}}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
fetch-depth: 0
- name: "Download Built JARs"
uses: actions/download-artifact@v4
with:
name: built-jars-${{ inputs.branch }}
- name: "Parse gradle properties"
id: gradle-properties
run: ./.github/scripts/parse-gradle-properties.sh
- name: "Parse changelog"
run: ./.github/scripts/parse-changelog.sh ${{ steps.gradle-properties.outputs.MOD_VERSION }}
- name: Publish ${{ matrix.mod_loader }}
uses: Kir-Antipov/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-tag: mc${{ steps.gradle-properties.outputs.MINECRAFT_VERSION }}-${{ steps.gradle-properties.outputs.MOD_VERSION }}
github-commitish: ${{ steps.gradle-properties.outputs.MINECRAFT_VERSION }}
curseforge-id: ${{ matrix.curseforge_project_id }}
curseforge-token: ${{ secrets.CURSEFORGE_RELEASE_TOKEN }}
modrinth-id: ${{ matrix.modrinth_project_id }}
modrinth-token: ${{ secrets.MODRINTH_RELEASE_TOKEN }}
name: ${{ steps.gradle-properties.outputs.MOD_NAME }} ${{ steps.gradle-properties.outputs.MOD_VERSION }}
version: ${{ matrix.mod_loader }}-mc${{ steps.gradle-properties.outputs.MINECRAFT_VERSION }}-${{ steps.gradle-properties.outputs.MOD_VERSION }}
loaders: ${{ join(matrix.supported_mod_loaders, ' ') }}
game-versions: "${{ steps.gradle-properties.outputs.MINECRAFT_VERSION }}\n${{ steps.gradle-properties.outputs.MIN_MINECRAFT_VERSION }}"
changelog-file: RELEASE_CHANGELOG.md
files: |
${{ matrix.mod_loader }}/build/libs/*[0-9].jar