Skip to content

Commit fd59d59

Browse files
Migrate to dispatch-and-wait action
1 parent 2138115 commit fd59d59

File tree

4 files changed

+41
-116
lines changed

4 files changed

+41
-116
lines changed

.github/workflows/auto_snapshot_update.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ on:
2020
description: "CurseForge GameVersion"
2121
required: true
2222
distinct_id:
23-
description: "Automatically set by the return-dispatch action (leave blank if running manually)"
2423
required: false
2524

2625
permissions:
@@ -95,20 +94,11 @@ jobs:
9594
git push
9695
9796
- name: Trigger CI
98-
id: ci_dispatch
99-
uses: codex-/return-dispatch@v2
97+
uses: Wurst-Imperium/dispatch-and-wait@v1
10098
with:
10199
token: ${{ github.token }}
102-
owner: Wurst-Imperium
100+
owner: ${{ github.repository_owner }}
103101
repo: ${{ github.event.repository.name }}
104102
ref: ${{ github.ref }}
105103
workflow: gradle.yml
106-
107-
- name: Wait for CI to finish (run ${{ steps.ci_dispatch.outputs.run_id }})
108-
uses: codex-/await-remote-run@v1
109-
with:
110-
token: ${{ github.token }}
111-
owner: Wurst-Imperium
112-
repo: ${{ github.event.repository.name }}
113-
run_id: ${{ steps.ci_dispatch.outputs.run_id }}
114104
run_timeout_seconds: 600 # 10 minutes

.github/workflows/gradle.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ on:
2424
workflow_dispatch:
2525
inputs:
2626
distinct_id:
27-
description: "Automatically set by the return-dispatch action (leave blank if running manually)"
2827
required: false
2928

3029
jobs:

.github/workflows/multi_publish.yml

Lines changed: 26 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -64,111 +64,63 @@ jobs:
6464
branch: ${{ fromJson(needs.prepare.outputs.branches) }}
6565
# TODO: Maybe also verify that the mod_version in each branch is as expected before publishing?
6666
steps:
67-
- name: Build publish inputs
68-
id: publish_inputs
69-
run: |
70-
JSON_STRING=$(cat << EOF
71-
{
72-
"close_milestone": "true",
73-
"upload_backups": "true",
74-
"publish_github": "true",
75-
"publish_curseforge": "true",
76-
"update_website": "true"
77-
}
78-
EOF
79-
)
80-
# Convert to single line and escape quotes
81-
echo "json=${JSON_STRING//$'\n'/}" >> "$GITHUB_OUTPUT"
8267
- name: Trigger publish workflow
83-
id: publish_dispatch
84-
uses: codex-/return-dispatch@v2
68+
uses: Wurst-Imperium/dispatch-and-wait@v1
8569
with:
8670
token: ${{ github.token }}
87-
owner: Wurst-Imperium
88-
repo: ChestESP
71+
owner: ${{ github.repository_owner }}
72+
repo: ${{ github.event.repository.name }}
8973
ref: ${{ matrix.branch }}
9074
workflow: publish.yml
91-
workflow_inputs: ${{ steps.publish_inputs.outputs.json }}
92-
- name: Wait for publish workflow to finish (run ${{ steps.publish_dispatch.outputs.run_id }})
93-
uses: codex-/await-remote-run@v1
94-
with:
95-
token: ${{ github.token }}
96-
owner: Wurst-Imperium
97-
repo: ChestESP
98-
run_id: ${{ steps.publish_dispatch.outputs.run_id }}
75+
workflow_inputs: |
76+
{
77+
"close_milestone": "true",
78+
"upload_backups": "true",
79+
"publish_github": "true",
80+
"publish_curseforge": "true",
81+
"update_website": "true"
82+
}
9983
run_timeout_seconds: 1800 # 30 minutes
10084

10185
announce_update:
10286
runs-on: ubuntu-latest
10387
needs: [prepare, publish_each]
10488
if: ${{ !failure() && !cancelled() && inputs.announce_update }}
10589
steps:
106-
- name: Build announcement inputs
107-
id: announce_inputs
108-
run: |
109-
JSON_STRING=$(cat << EOF
110-
{
111-
"mod": "chestesp",
112-
"mod_version": "${{ inputs.mod_version }}",
113-
"dry_run": "${{ inputs.dry_run }}"
114-
}
115-
EOF
116-
)
117-
# Convert to single line and escape quotes
118-
echo "json=${JSON_STRING//$'\n'/}" >> "$GITHUB_OUTPUT"
11990
- name: Trigger announce workflow
120-
id: announce_dispatch
121-
uses: codex-/return-dispatch@v2
91+
uses: Wurst-Imperium/dispatch-and-wait@v1
12292
with:
12393
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }}
12494
owner: Wurst-Imperium
12595
repo: wimods.net
12696
ref: master
12797
workflow: announce_mod_update.yml
128-
workflow_inputs: ${{ steps.announce_inputs.outputs.json }}
129-
- name: Wait for announce workflow to finish (run ${{ steps.announce_dispatch.outputs.run_id }})
130-
uses: codex-/await-remote-run@v1
131-
with:
132-
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }}
133-
owner: Wurst-Imperium
134-
repo: wimods.net
135-
run_id: ${{ steps.announce_dispatch.outputs.run_id }}
98+
workflow_inputs: |
99+
{
100+
"mod": "chestesp",
101+
"mod_version": "${{ inputs.mod_version }}",
102+
"dry_run": "${{ inputs.dry_run }}"
103+
}
136104
run_timeout_seconds: 600 # 10 minutes
137105

138106
announce_ports:
139107
runs-on: ubuntu-latest
140108
needs: [prepare, publish_each]
141109
if: ${{ !failure() && !cancelled() && inputs.announce_ports }}
142110
steps:
143-
- name: Build announcement inputs
144-
id: announce_inputs
145-
run: |
146-
JSON_STRING=$(cat << EOF
147-
{
148-
"mod": "chestesp",
149-
"mod_version": "${{ inputs.mod_version }}",
150-
"branches": "${{ inputs.branches }}",
151-
"dry_run": "${{ inputs.dry_run }}"
152-
}
153-
EOF
154-
)
155-
# Convert to single line and escape quotes
156-
echo "json=${JSON_STRING//$'\n'/}" >> "$GITHUB_OUTPUT"
157111
- name: Trigger announce workflow
158-
id: announce_dispatch
159-
uses: codex-/return-dispatch@v2
112+
uses: Wurst-Imperium/dispatch-and-wait@v1
160113
with:
161114
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }}
162115
owner: Wurst-Imperium
163116
repo: wimods.net
164117
ref: master
165118
workflow: announce_mod_ports.yml
166-
workflow_inputs: ${{ steps.announce_inputs.outputs.json }}
167-
- name: Wait for announce workflow to finish (run ${{ steps.announce_dispatch.outputs.run_id }})
168-
uses: codex-/await-remote-run@v1
169-
with:
170-
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }}
171-
owner: Wurst-Imperium
172-
repo: wimods.net
173-
run_id: ${{ steps.announce_dispatch.outputs.run_id }}
119+
workflow_inputs: |
120+
{
121+
"mod": "chestesp",
122+
"mod_version": "${{ inputs.mod_version }}",
123+
"branches": "${{ inputs.branches }}",
124+
"dry_run": "${{ inputs.dry_run }}"
125+
}
174126
run_timeout_seconds: 600 # 10 minutes

.github/workflows/publish.yml

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ on:
3030
type: boolean
3131
default: false
3232
distinct_id:
33-
description: "Automatically set by the return-dispatch action (leave blank if running manually)"
3433
required: false
3534

3635
permissions:
@@ -110,41 +109,26 @@ jobs:
110109
id: website_inputs
111110
if: ${{ inputs.update_website && inputs.publish_curseforge }}
112111
run: |
113-
MOD_VERSION=$(grep "^mod_version=" gradle.properties | cut -d'=' -f2 | tr -d ' \r' | sed 's/-MC.*$//')
114-
MC_VERSION=$(grep "^minecraft_version=" gradle.properties | cut -d'=' -f2 | tr -d ' \r')
115-
FAPI_VERSION=$(grep "^fabric_version=" gradle.properties | cut -d'=' -f2 | tr -d ' \r')
116-
JSON_STRING=$(cat << EOF
117-
{
118-
"mod": "chestesp",
119-
"modloader": "fabric",
120-
"mod_version": "$MOD_VERSION",
121-
"mc_version": "$MC_VERSION",
122-
"fapi_version": "$FAPI_VERSION",
123-
"file_id": "${{ steps.cf_file_id.outputs.file_id }}"
124-
}
125-
EOF
126-
)
127-
# Convert to single line and escape quotes
128-
echo "json=${JSON_STRING//$'\n'/}" >> "$GITHUB_OUTPUT"
112+
echo "mod_version=$(grep '^mod_version=' gradle.properties | cut -d'=' -f2 | tr -d ' \r' | sed 's/-MC.*$//')" >> "$GITHUB_OUTPUT"
113+
echo "mc_version=$(grep '^minecraft_version=' gradle.properties | cut -d'=' -f2 | tr -d ' \r')" >> "$GITHUB_OUTPUT"
114+
echo "fapi_version=$(grep '^fabric_version=' gradle.properties | cut -d'=' -f2 | tr -d ' \r')" >> "$GITHUB_OUTPUT"
129115
130116
- name: Trigger website update
131-
id: website_dispatch
132117
if: ${{ inputs.update_website && inputs.publish_curseforge }}
133-
uses: codex-/return-dispatch@v2
118+
uses: Wurst-Imperium/dispatch-and-wait@v1
134119
with:
135120
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }}
136121
owner: Wurst-Imperium
137122
repo: wimods.net
138123
ref: master
139124
workflow: add_mod_port.yml
140-
workflow_inputs: ${{ steps.website_inputs.outputs.json }}
141-
142-
- name: Wait for website update to finish (run ${{ steps.website_dispatch.outputs.run_id }})
143-
if: ${{ inputs.update_website && inputs.publish_curseforge }}
144-
uses: codex-/await-remote-run@v1
145-
with:
146-
token: ${{ secrets.WIMODS_NET_PUBLISH_TOKEN }}
147-
owner: Wurst-Imperium
148-
repo: wimods.net
149-
run_id: ${{ steps.website_dispatch.outputs.run_id }}
125+
workflow_inputs: |
126+
{
127+
"mod": "chestesp",
128+
"modloader": "fabric",
129+
"mod_version": "${{ steps.website_inputs.outputs.mod_version }}",
130+
"mc_version": "${{ steps.website_inputs.outputs.mc_version }}",
131+
"fapi_version": "${{ steps.website_inputs.outputs.fapi_version }}",
132+
"file_id": "${{ steps.cf_file_id.outputs.file_id }}"
133+
}
150134
run_timeout_seconds: 600 # 10 minutes

0 commit comments

Comments
 (0)