Skip to content

Commit ba0cafc

Browse files
author
jh-devv
authored
Merge pull request #63 from jh-devv/jh-devv-force
ci!: Overhauled some stuff :3
2 parents f6b9f10 + 3f19110 commit ba0cafc

File tree

5 files changed

+89
-21
lines changed

5 files changed

+89
-21
lines changed

.github/actions/build/action.yml

+11
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,25 @@ runs:
1919
using: "composite"
2020

2121
steps:
22+
23+
# --- Checkout the repo
2224
- name: Check Out Git Repository
2325
uses: actions/checkout@v3
2426
with:
2527
fetch-depth: 0
2628
ref: 'main'
2729

30+
31+
# --- Install Packwiz
2832
- name: Install packwiz
2933
uses: supplypike/setup-bin@v3
3034
with:
3135
uri: "https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip"
3236
name: "packwiz"
3337
version: "linux"
3438

39+
40+
# --- Build Modrinth Pack If Wanted
3541
- name: Build Modrinth Modpack
3642
if: inputs.build-modrinth == 'true'
3743
run: |
@@ -40,6 +46,8 @@ runs:
4046
shell: bash
4147
working-directory: ${{ inputs.modpack }}
4248

49+
50+
# --- Build Curseforge Pack If Wanted
4351
- name: Build CurseForge Modpack
4452
if: inputs.build-curse == 'true'
4553
run: |
@@ -48,6 +56,9 @@ runs:
4856
shell: bash
4957
working-directory: ${{ inputs.modpack }}
5058

59+
60+
# --- Upload the pack/s to releases
61+
5162
- name: Upload Modrinth Modpack to GitHub Releases
5263
if: inputs.build-modrinth == 'true'
5364
run: |

.github/actions/bump-pack/action.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,31 @@ inputs:
1313
description: 'Path to the pack config file'
1414
required: false
1515
default: 'pack.toml'
16+
branch:
17+
description: "Branch, where to do the bump"
18+
required: false
19+
default: 'main'
1620

1721
runs:
1822
using: 'composite'
1923

2024
steps:
25+
26+
# --- Checkout with the named branch
2127
- name: Check Out Git Repository
2228
uses: actions/checkout@v3
29+
with:
30+
ref: ${{ inputs.branch }}
2331

24-
- name: Set the version
32+
33+
# --- Use sed to set the version
34+
- name: Set the Version
2535
run: sed -i 's/version = "[^"]*"/version = "${{ inputs.release-tag }}"/' ${{ inputs.modpack }}/${{ inputs.pack-file }}
2636
shell: bash
2737

28-
- name: Push the Updated Version
38+
39+
# --- Push the version
40+
- name: Push The Updated Version
2941
uses: stefanzweifel/git-auto-commit-action@v4
3042
with:
3143
commit_message: "chore(${{ inputs.modpack }}): bump version to ${{ inputs.release-tag }}"

.github/actions/parse/action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ runs:
2323
using: 'composite'
2424

2525
steps:
26+
27+
# --- Checkout repo
2628
- name: Check Out Git Repository
2729
uses: actions/checkout@v3
2830

31+
32+
# --- Parse the pack.toml
33+
# I am bored so sorry that I don't explain this, you should probably read the code?
2934
- name: Parse the pack.toml
3035
id: parse
3136
run: |

.github/actions/release/action.yaml

+19-1
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,20 @@ inputs:
3636
runs:
3737
using: "composite"
3838
steps:
39+
40+
# --- Checkout the repo
3941
- name: Check Out Git Repository
4042
uses: actions/checkout@v3
4143

44+
45+
# --- Get latest tag
46+
# TODO: Should probably be switched to an input
4247
- name: Get Latest tag
4348
id: tag
4449
uses: WyriHaximus/github-action-get-previous-tag@v1
4550

51+
52+
# --- Download the pack files
4653
- name: Download the pack files
4754
uses: robinraju/[email protected]
4855
id: download-files
@@ -52,7 +59,8 @@ runs:
5259
tarBall: false
5360
zipBall: false
5461

55-
62+
63+
# --- Get latest release description
5664
- name: Get latest release description
5765
uses: cardinalby/git-get-release-action@v1
5866
id: latest-release
@@ -61,6 +69,8 @@ runs:
6169
with:
6270
tag: ${{ steps.tag.outputs.tag }}
6371

72+
73+
# --- Set publish version-type
6474
- name: Set publish version-type
6575
id: release-type
6676
run: |
@@ -73,16 +83,22 @@ runs:
7383
fi
7484
shell: bash
7585

86+
87+
# --- Pipe latest release description to file
7688
- name: Pipe latest release description to file
7789
run: echo "${{ steps.latest-release.outputs.body }}" > CHANGELOG.release.md
7890
shell: bash
7991

92+
93+
# --- Print status
8094
- name: Print status
8195
run: |
8296
echo "::notice ::⚙ Assets from latest release ${{ steps.latest-release.outputs.tag_name }} downloaded successfully!"
8397
echo "::notice ::⚙ Latest release ${{ steps.latest-release.outputs.tag_name }} description piped into a file successfully!"
8498
shell: bash
8599

100+
101+
# --- Publish to modrinth using the inputs
86102
- name: Publish to Modrinth
87103
id: modrinth
88104
if: inputs.upload-modrinth == 'true'
@@ -103,6 +119,8 @@ runs:
103119
echo "::notice ::☀ Modpack ${{ inputs.modpack }} has been uploaded to Modrinth with ${{ inputs.MODRINTH_ID }}"
104120
shell: bash
105121

122+
123+
# --- Publish to curseforge using the inputs
106124
- name: Publish to CurseForge
107125
id: curseforge
108126
if: inputs.upload-curse == 'true'

.github/workflows/pipeline.yml

+40-18
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ jobs:
2727

2828
steps:
2929

30+
# -- Checkout repo
3031
- name: Check Out Git Repository
3132
uses: actions/checkout@v4
3233

3334

35+
# --- Parse the modpacks to and list
36+
# This just parses the folders that have pack.toml
3437
- name: List Modpacks
3538
id: list_modpacks
3639
run: |
@@ -45,6 +48,8 @@ jobs:
4548
4649
echo "modpack_folders=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${modpackFolders[@]}")" >> "$GITHUB_OUTPUT"
4750
51+
52+
# --- Print an nice msg about parsing
4853
- name: Current detected modpacks
4954
run: |
5055
echo "::notice ::⚙ Current detected modpacks: ${{ steps.list_modpacks.outputs.modpack_folders }}"
@@ -77,7 +82,7 @@ jobs:
7782
steps:
7883

7984
# --- Release please
80-
85+
# Creates and manages the prs and releases
8186
- name: Perform Release with Release Please
8287
id: release-please
8388
uses: google-github-actions/release-please-action@v3
@@ -94,38 +99,54 @@ jobs:
9499
{"type":"update","section":"⚘ Modpack Updates","hidden":false},
95100
{"type":"chore","section":"⛭ Miscellaneous","hidden":true}]
96101
102+
103+
# --- Parse version from PR Title when creating PR's
104+
# Had to do this cause like to bump on the release pleae branch
105+
# The tests for the shitty Regex can be found here: https://regexr.com/7lb8e
106+
- name: Parse tag from PR title
107+
uses: actions-ecosystem/action-regex-match@v2
108+
id: version
109+
with:
110+
text: ${{ fromJson(steps.release-please.outputs.pr).title }}
111+
regex: '(?<=\s)(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$'
112+
if: ${{ steps.release-please.outputs.pr != '' }}
113+
114+
115+
# --- Checkout the git repo
116+
# Remembed to do this AFTER release please
97117
- name: Check Out Git Repository
98118
uses: actions/checkout@v4
99119
with:
100120
fetch-depth: 0
101121

102122

103-
# --- Bump pack.toml version
104-
# Get Latest tag
105-
# TODO: Change to release please tag
106-
- name: Get Latest tag
107-
id: tag
108-
uses: WyriHaximus/github-action-get-previous-tag@v1
109-
if: ${{ steps.release-please.outputs.releases_created }}
110-
111-
- name: Bump version
123+
# --- Bump version
124+
# Now we should use the parsed release to bump the version on the files on the release please branch
125+
- name: Bump Version
112126
uses: ./.github/actions/bump-pack
113127
with:
114-
release-tag: ${{ steps.tag.outputs.tag }}
128+
release-tag: ${{ steps.version.outputs.match }}
115129
modpack: ${{ matrix.modpack }}
116-
if: ${{ steps.release-please.outputs.releases_created }}
130+
branch: ${{ fromJson(steps.release-please.outputs.pr).headBranchName }}
131+
if: ${{ steps.release-please.outputs.pr != '' }}
117132

118133

119-
# --- Handle the configs
134+
# --- Get latest tag
135+
# Should probably be switched to use the release please tag but whatever
136+
- name: Get Latest tag
137+
id: tag
138+
uses: WyriHaximus/github-action-get-previous-tag@v1
139+
if: ${{ steps.release-please.outputs.releases_created }}
120140

121-
- name: Parse pack file
141+
# --- Handle the configs
142+
- name: Parse Pack File
122143
id: parse
123144
uses: ./.github/actions/parse
124145
with:
125146
modpack: ${{ matrix.modpack }}
126147
if: ${{ steps.release-please.outputs.releases_created }}
127148

128-
- name: Set mod vendors
149+
- name: Set Mod Vendors
129150
id: set-mod-vendors
130151
run: |
131152
[[ ! -z "${{ secrets.CURSEFORGE_TOKEN }}" && ! -z "${{ secrets.CURSEFORGE_ID }}" ]] && echo "curseforge=true" >> $GITHUB_OUTPUT || echo "curseforge=false" >> $GITHUB_OUTPUT
@@ -135,8 +156,7 @@ jobs:
135156

136157

137158
# --- Build an release
138-
139-
- name: Build modpack
159+
- name: Build Modpack
140160
uses: ./.github/actions/build
141161
with:
142162
modpack: ${{ matrix.modpack }}
@@ -145,7 +165,9 @@ jobs:
145165
build-curse: ${{ env.default-release-curseforge }}
146166
if: ${{ steps.release-please.outputs.releases_created }}
147167

148-
- name: Release modpack to vendors
168+
169+
# --- Release
170+
- name: Release Modpack to Vendors
149171
uses: ./.github/actions/release
150172
with:
151173
modpack: ${{ matrix.modpack }}

0 commit comments

Comments
 (0)