Skip to content

Commit f6c09cb

Browse files
committed
Allow builds to still process on fork repos without having the publish token set
1 parent 36d2056 commit f6c09cb

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,33 @@ jobs:
326326
- name: Debug output
327327
run: ls -laR .
328328

329+
check-tokens:
330+
name: Check the access tokens used for publishing
331+
needs: [build-linux, build-macos, build-windows]
332+
runs-on: ubuntu-latest
333+
if: inputs.workflowDebug != true && inputs.packagingDebug != true && inputs.skipForumPublish != true
334+
outputs:
335+
publish-forum: ${{ steps.check-token-forum.token-set == 'true' }}
336+
publish-github: ${{ steps.check-token-github.token-set == 'true' }}
337+
steps:
338+
- id: check-token-forum
339+
name: Check the token used for publishing releases on the forum
340+
env:
341+
INTERSECTBOT_FORUM_TOKEN: ${{ secrets.INTERSECTBOT_FORUM_TOKEN }}
342+
if: ${{ env.INTERSECTBOT_FORUM_TOKEN != '' }}
343+
run: echo "token-set=true" >> "$GITHUB_OUTPUT"
344+
- id: check-token-github
345+
name: Check the token used for publishing GitHub releases
346+
env:
347+
INTERSECTBOT_ACCESS_TOKEN: ${{ secrets.INTERSECTBOT_ACCESS_TOKEN }}
348+
if: ${{ env.INTERSECTBOT_ACCESS_TOKEN != '' }}
349+
run: echo "token-set=true" >> "$GITHUB_OUTPUT"
350+
329351
publish-github:
330352
name: Publish GitHub Release
331-
if: inputs.workflowDebug != true
332-
needs: [build-linux, build-macos, build-windows]
353+
needs: [check-tokens]
333354
runs-on: ubuntu-latest
355+
if: inputs.workflowDebug != true && needs.check-tokens.outputs.publish-forum == 'true'
334356
steps:
335357
- name: Checkout Code
336358
uses: actions/checkout@v4
@@ -387,26 +409,11 @@ jobs:
387409
prerelease: true
388410
tag: v${{ env.VERSION_PREFIX }}${{ env.VERSION_SUFFIX }}.${{ github.run_number }}
389411

390-
check-publish-forum:
391-
name: Check if token set to publish to forum
392-
if: inputs.workflowDebug != true && inputs.packagingDebug != true && inputs.skipForumPublish != true
393-
needs: publish-github
394-
runs-on: ubuntu-latest
395-
outputs:
396-
skip: ${{ steps.check-INTERSECTBOT_FORUM_TOKEN.outputs.skip == 'true' }}
397-
steps:
398-
- id: check-INTERSECTBOT_FORUM_TOKEN
399-
name: Check INTERSECTBOT_FORUM_TOKEN
400-
env:
401-
INTERSECTBOT_FORUM_TOKEN: ${{ secrets.INTERSECTBOT_FORUM_TOKEN }}
402-
if: ${{ env.INTERSECTBOT_FORUM_TOKEN == '' }}
403-
run: echo "skip=true" >> "$GITHUB_OUTPUT"
404-
405412
publish-forum:
406413
name: Publish to Forum
407-
if: inputs.workflowDebug != true && inputs.packagingDebug != true && inputs.skipForumPublish != true && needs.check-publish-forum.outputs.skip != 'true'
408-
needs: check-publish-forum
414+
needs: [check-tokens]
409415
runs-on: ubuntu-latest
416+
if: inputs.workflowDebug != true && inputs.packagingDebug != true && inputs.skipForumPublish != true && needs.check-tokens.outputs.publish-forum == 'true'
410417
steps:
411418
- name: Publish to Forum
412419
uses: AscensionGameDev/actions@0223df40becb110039c705c02cfd2cd8f274199c

0 commit comments

Comments
 (0)