Skip to content

Commit aeed716

Browse files
Update publish workflows
1 parent 4400a3a commit aeed716

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

.github/workflows/multi_publish.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,22 @@ on:
66
inputs:
77
wurst_version:
88
description: "Wurst version (without v or -MC)"
9-
required: true
109
type: string
10+
required: true
1111
branches:
1212
description: "Space-separated list of branches to publish from"
13-
required: true
1413
type: string
14+
required: true
1515
announce_update:
1616
description: "Announce as an update on WurstForum"
17-
required: true
1817
type: boolean
1918
default: false
2019
announce_ports:
2120
description: "Announce as ports on WurstForum"
22-
required: true
2321
type: boolean
2422
default: false
2523
dry_run:
2624
description: "Dry-run mode (don't actually publish anything)"
27-
required: false
2825
type: boolean
2926
default: false
3027

@@ -47,6 +44,15 @@ jobs:
4744
JSON_ARRAY="[${quoted_branches%,}]"
4845
echo "branches=$JSON_ARRAY" >> "$GITHUB_OUTPUT"
4946
echo "Branches: $JSON_ARRAY" >> "$GITHUB_STEP_SUMMARY"
47+
- name: Verify mod_version is as expected
48+
run: |
49+
expected_prefix="v${{ inputs.wurst_version }}-MC"
50+
for branch in ${{ inputs.branches }}; do
51+
url="https://raw.githubusercontent.com/${{ github.repository }}/${branch}/gradle.properties"
52+
actual=$(curl -sf "$url" | grep "^mod_version=" | cut -d'=' -f2)
53+
echo "$branch: $actual"
54+
[[ "$actual" == "$expected_prefix"* ]] || { echo "::error::Expected $expected_prefix*, got $actual"; exit 1; }
55+
done
5056
5157
publish_each:
5258
runs-on: ubuntu-latest
@@ -62,14 +68,13 @@ jobs:
6268
fail-fast: true
6369
matrix:
6470
branch: ${{ fromJson(needs.prepare.outputs.branches) }}
65-
# TODO: Maybe also verify that the wurst_version in each branch is as expected before publishing?
6671
steps:
6772
- name: Trigger publish workflow
6873
uses: Wurst-Imperium/dispatch-and-wait@v1
6974
with:
7075
token: ${{ github.token }}
71-
owner: Wurst-Imperium
72-
repo: Wurst7
76+
owner: ${{ github.repository_owner }}
77+
repo: ${{ github.event.repository.name }}
7378
ref: ${{ matrix.branch }}
7479
workflow: publish.yml
7580
workflow_inputs: |

.github/workflows/publish.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,22 @@ on:
66
inputs:
77
close_milestone:
88
description: "Close milestone"
9-
required: true
109
type: boolean
1110
default: true
1211
upload_backups:
1312
description: "Upload to backups server"
14-
required: true
1513
type: boolean
1614
default: true
1715
publish_github:
1816
description: "Publish to GitHub"
19-
required: true
2017
type: boolean
2118
default: true
2219
update_website:
2320
description: "Update WurstClient.net post (only works if there already is one)"
24-
required: true
2521
type: boolean
2622
default: false
2723
distinct_id:
24+
type: string
2825
required: false
2926

3027
permissions:
@@ -69,6 +66,7 @@ jobs:
6966
run: ./gradlew build --stacktrace --warning-mode=fail
7067

7168
- name: Create and push tag
69+
if: ${{ github.ref_type != 'tag' }}
7270
run: |
7371
MOD_VERSION=$(grep "^mod_version=" gradle.properties | cut -d'=' -f2 | tr -d ' \r')
7472
git config --global user.name "Wurst-Bot"

0 commit comments

Comments
 (0)