-
Notifications
You must be signed in to change notification settings - Fork 22
120 lines (100 loc) · 2.84 KB
/
publish.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
name: 'Publish'
on:
workflow_dispatch:
inputs:
label:
type: choice
description: 'Version label'
options:
- -beta
- -alpha
default: ''
required: false
permissions:
contents: write
statuses: write
jobs:
build:
name: 'Build'
runs-on: windows-latest
strategy:
matrix:
loader: [ 'Forge', 'Fabric' ]
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-tags: true
- name: 'Set up JDK 17'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: 'Build ${{ matrix.loader }} with Gradle'
uses: gradle/gradle-build-action@v2
with:
arguments: :${{ matrix.loader }}:build
cache-read-only: false
- name: 'Upload ${{ matrix.loader }} artifacts'
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: 'Artifacts-${{ matrix.loader }}'
path: ${{ matrix.loader }}/build/libs/*.jar
publish:
name: 'Publish'
runs-on: windows-latest
needs: [build]
continue-on-error: true
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-tags: true
- name: 'Set up JDK 17'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: 'Publish with Gradle'
uses: gradle/gradle-build-action@v2
with:
arguments: publishMod
cache-read-only: false
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
release:
name: 'Create release'
runs-on: windows-latest
needs: [build, publish]
continue-on-error: true
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-tags: true
- name: 'Get latest tag'
id: latest-tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: '0.0.0.0'
- name: 'Download ${{ matrix.loader }} artifacts'
uses: actions/download-artifact@v4
with:
pattern: 'Artifacts-*'
path: artifacts/
merge-multiple: true
- name: 'Create release'
uses: softprops/action-gh-release@v1
with:
name: "${{ github.event.repository.name }}-${{ github.ref_name }}-${{ steps.latest-tag.outputs.tag }}${{ inputs.label }}"
tag_name: ${{ steps.latest-tag.outputs.tag }}
target_commitish: ${{ github.ref }}
body_path: CHANGELOG.md
files: |
'artifacts/*'
'!artifacts/*-slim.*'