Skip to content

Commit b788f18

Browse files
committed
Allow non-1.20.1 or 1.21 releases
1 parent 7af0e91 commit b788f18

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

.github/workflows/publish-on-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Get Config
1818
uses: actions/checkout@v4
1919
with:
20-
ref: '1.20.1'
20+
ref: ${{ github.ref_name }}
2121
sparse-checkout: '.github/json'
2222
- name: Generate changelog
2323
id: changelog
@@ -39,8 +39,8 @@ jobs:
3939
uses: ./.github/workflows/publish.yml
4040
with:
4141
simulate: ${{ startsWith(github.event.release.name, 'simulate') || github.repository_owner != 'GregTechCEu' }}
42-
branch: '1.20.1'
4342
tag-name: ${{ github.ref_name }}
43+
version: '1.20.1'
4444
release-body: ${{ github.event.release.body }}
4545
changelog-body: ${{ needs.meta.outputs.CHANGELOG }}
4646

@@ -52,7 +52,7 @@ jobs:
5252
uses: ./.github/workflows/publish.yml
5353
with:
5454
simulate: ${{ startsWith(github.event.release.name, 'simulate') || github.repository_owner != 'GregTechCEu' }}
55-
branch: '1.21'
5655
tag-name: ${{ github.ref_name }}
56+
version: '1.21'
5757
release-body: ${{ github.event.release.body }}
5858
changelog-body: ${{ needs.meta.outputs.CHANGELOG }}

.github/workflows/publish.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ on:
66
simulate:
77
required: false
88
type: boolean
9-
branch:
10-
description: 'Branch to checkout; 1.20.1 or 1.21'
9+
tag-name:
10+
description: 'Tag to build from and upload to'
1111
required: true
1212
type: string
13-
tag-name:
14-
description: 'Tag to upload to'
13+
version:
14+
description: 'Version identifier; 1.20.1 or 1.21'
1515
required: true
1616
type: string
1717
release-body:
@@ -36,11 +36,11 @@ jobs:
3636
steps:
3737
- uses: actions/checkout@v4
3838
with:
39-
ref: ${{ inputs.branch }}
39+
ref: ${{ inputs.tag-name }}
4040
- name: Setup Build
4141
uses: ./.github/actions/build_setup
4242
with:
43-
ref: ${{ inputs.branch }}
43+
ref: ${{ inputs.tag-name }}
4444
- name: Get Version
4545
id: ver
4646
run: echo "version=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT
@@ -49,7 +49,7 @@ jobs:
4949
- name: Upload Build Artifacts
5050
uses: actions/upload-artifact@v4
5151
with:
52-
name: build-artifacts-${{ inputs.branch }}
52+
name: build-artifacts-${{ inputs.tag-name }}
5353
path: build/libs/*
5454
if-no-files-found: error
5555
retention-days: 3
@@ -70,7 +70,7 @@ jobs:
7070
- name: Download artifacts
7171
uses: actions/download-artifact@v4
7272
with:
73-
name: build-artifacts-${{ inputs.branch }}
73+
name: build-artifacts-${{ inputs.tag-name }}
7474
- name: Upload artifacts to release
7575
uses: softprops/action-gh-release@v2
7676
with:
@@ -89,13 +89,13 @@ jobs:
8989
- name: Download artifacts
9090
uses: actions/download-artifact@v4
9191
with:
92-
name: build-artifacts-${{ inputs.branch }}
92+
name: build-artifacts-${{ inputs.tag-name }}
9393
- name: Publish Mod
9494
env:
95-
MC_VERSION: ${{ inputs.branch == '1.21' && '1.21.1' || '1.20.1' }}
96-
LOADER: ${{ inputs.branch == '1.21' && 'neoforge' || 'forge' }}
97-
JAVA: ${{ inputs.branch == '1.21' && '21' || '17' }}
98-
VERSION_TYPE: ${{ inputs.branch == '1.21' && 'beta' || 'beta' }}
95+
MC_VERSION: ${{ inputs.version == '1.21' && '1.21.1' || '1.20.1' }}
96+
LOADER: ${{ inputs.version == '1.21' && 'neoforge' || 'forge' }}
97+
JAVA: ${{ inputs.version == '1.21' && '21' || '17' }}
98+
VERSION_TYPE: ${{ inputs.version == '1.21' && 'beta' || 'beta' }}
9999
uses: Kir-Antipov/mc-publish@v3.3.0
100100
with:
101101
modrinth-id: 7tG215v7
@@ -122,13 +122,13 @@ jobs:
122122
- name: Download artifacts
123123
uses: actions/download-artifact@v4
124124
with:
125-
name: build-artifacts-${{ inputs.branch }}
125+
name: build-artifacts-${{ inputs.tag-name }}
126126
- name: Publish Mod
127127
env:
128-
MC_VERSION: ${{ inputs.branch == '1.21' && '1.21.1' || '1.20.1' }}
129-
LOADER: ${{ inputs.branch == '1.21' && 'neoforge' || 'forge' }}
130-
JAVA: ${{ inputs.branch == '1.21' && '21' || '17' }}
131-
VERSION_TYPE: ${{ inputs.branch == '1.21' && 'alpha' || 'beta' }}
128+
MC_VERSION: ${{ inputs.version == '1.21' && '1.21.1' || '1.20.1' }}
129+
LOADER: ${{ inputs.version == '1.21' && 'neoforge' || 'forge' }}
130+
JAVA: ${{ inputs.version == '1.21' && '21' || '17' }}
131+
VERSION_TYPE: ${{ inputs.version == '1.21' && 'alpha' || 'beta' }}
132132
uses: Kir-Antipov/mc-publish@v3.3.0
133133
with:
134134
curseforge-id: 890405
@@ -156,12 +156,12 @@ jobs:
156156
steps:
157157
- uses: actions/checkout@v4
158158
with:
159-
ref: ${{ inputs.branch }}
159+
ref: ${{ inputs.version }}
160160
- name: Bump Version
161161
run: |
162162
git config user.name 'github-actions[bot]'
163163
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
164-
git switch -C gh/release-${{ inputs.branch }}
164+
git switch -C gh/release-${{ inputs.version }}
165165
BUMPED=$(echo ${{ needs.build.outputs.ver }} | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.)
166166
sed -i "s/= ${{ needs.build.outputs.ver }}/= ${BUMPED}/" gradle.properties
167167
git commit -am "Bump version to ${BUMPED}"
@@ -174,5 +174,5 @@ jobs:
174174
env:
175175
GH_TOKEN: ${{ github.token }}
176176
run: |
177-
git push --force --set-upstream origin gh/release-${{ inputs.branch }}
178-
gh pr create -B ${{ inputs.branch }} -H gh/release-${{ inputs.branch }} --title "RELEASE for ${{ inputs.branch }} [no-snapshot]" --body "Created by GH Workflow" --label "ignore changelog"
177+
git push --force --set-upstream origin gh/release-${{ inputs.version }}
178+
gh pr create -B ${{ inputs.version }} -H gh/release-${{ inputs.version }} --title "RELEASE for ${{ inputs.version }} [no-snapshot]" --body "Created by GH Workflow" --label "ignore changelog"

0 commit comments

Comments
 (0)