This repository has been archived by the owner on Sep 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (121 loc) · 4.72 KB
/
pipeline.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Modpack Release | Pipeline
on:
push:
branches:
- main
env:
pack-file: 'pack.toml'
default-release-modrinth: 'true'
default-release-curseforge: 'false'
jobs:
parse-current-modpacks:
name: Parse current modpacks to a list
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
modpack_folders: ${{ steps.list_modpacks.outputs.modpack_folders }}
steps:
- name: Check Out Git Repository
uses: actions/checkout@v4
- name: List Modpacks
id: list_modpacks
run: |
modpackFolders=()
for folder in *; do
if [ -d "$folder" ]; then
if [ -e "$folder/pack.toml" ]; then
modpackFolders+=("$folder")
fi
fi
done
echo "modpack_folders=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${modpackFolders[@]}")" >> "$GITHUB_OUTPUT"
- name: Current detected modpacks
run: |
echo "::notice ::⚙ Current detected modpacks: ${{ steps.list_modpacks.outputs.modpack_folders }}"
release-please:
needs:
- parse-current-modpacks
if: ${{ (needs.parse-current-modpacks.outputs.modpack_folders) != '[]' }}
strategy:
fail-fast: false
matrix:
modpack: ${{ fromJson(needs.parse-current-modpacks.outputs.modpack_folders) }}
name: Handle Releases
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ matrix.modpack }}
permissions:
contents: write
pull-requests: write
steps:
# --- Release please
- name: Perform Release with Release Please
id: release-please
uses: google-github-actions/release-please-action@v3
with:
monorepo-tags: true
path: ${{ matrix.modpack }}
release-type: simple
package-name: ${{ matrix.modpack }}
prerelease: true
changelog-types: >
[{"type":"feat","section":"★ Features","hidden":false},
{"type":"fix","section":"♻ Bug Fixes","hidden":false},
{"type":"mod","section":"☀ Modpack Changes","hidden":false},
{"type":"update","section":"⚘ Modpack Updates","hidden":false},
{"type":"chore","section":"⛭ Miscellaneous","hidden":true}]
- name: Check Out Git Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# --- Bump pack.toml version
# Get Latest tag
# TODO: Change to release please tag
- name: Get Latest tag
id: tag
uses: WyriHaximus/github-action-get-previous-tag@v1
if: ${{ steps.release-please.outputs.releases_created }}
- name: Bump version
uses: ./.github/actions/bump-version-pack
with:
release-tag: ${{ steps.tag.outputs.tag }}
modpack: ${{ matrix.modpack }}
if: ${{ steps.release-please.outputs.releases_created }}
# --- Handle the configs
- name: Parse pack file
id: parse
uses: ./.github/actions/parse
with:
modpack: ${{ matrix.modpack }}
if: ${{ steps.release-please.outputs.releases_created }}
- name: Set mod vendors
id: set-mod-vendors
run: |
[[ ! -z "${{ secrets.CURSEFORGE_TOKEN }}" && ! -z "${{ secrets.CURSEFORGE_ID }}" ]] && echo "curseforge=true" >> $GITHUB_OUTPUT || echo "curseforge=false" >> $GITHUB_OUTPUT
[[ ! -z "${{ secrets.MODRINTH_TOKEN }}" && ! -z "${{ secrets.MODRINTH_ID }}" ]] && echo "modrinth=true" >> $GITHUB_OUTPUT || echo "modrinth=false" >> $GITHUB_OUTPUT
shell: bash
if: ${{ steps.release-please.outputs.releases_created }}
# --- Build an release
- name: Build modpack
uses: ./.github/actions/build
with:
modpack: ${{ matrix.modpack }}
release-tag: ${{ steps.tag.outputs.tag }}
build-modrinth: ${{ env.default-release-modrinth }}
build-curse: ${{ env.default-release-curseforge }}
if: ${{ steps.release-please.outputs.releases_created }}
- name: Release modpack to vendors
uses: ./.github/actions/release
with:
modpack: ${{ matrix.modpack }}
loader: ${{ steps.parse.outputs.loader }}
game-version: ${{ steps.parse.outputs.game-version }}
upload-modrinth: ${{ steps.set-mod-vendors.outputs.modrinth }}
upload-curse: ${{ steps.set-mod-vendors.outputs.curseforge }}
MODRINTH_ID: ${{ secrets.MODRINTH_ID }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
if: |
steps.release-please.outputs.releases_created &&
(steps.set-mod-vendors.outputs.modrinth || steps.set-mod-vendors.outputs.curseforge)