Pre-event tweaks & config mid-event updating #59
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Trigger website frontend build | |
| on: | |
| push: | |
| branches: [dev] | |
| paths: | |
| - 'wiki/**' | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| stage: | |
| description: "Target stage to dispatch" | |
| required: true | |
| type: choice | |
| options: | |
| - dev | |
| - prod | |
| default: dev | |
| force_rebuild: | |
| description: "Force full rebuild in target workflow" | |
| required: false | |
| type: boolean | |
| default: false | |
| env: | |
| TARGET_OWNER: 42core-team | |
| TARGET_REPO: website | |
| TARGET_WORKFLOW_FILE: frontend-build.yml | |
| jobs: | |
| dispatch-dev: | |
| name: Dispatch DEV deploy | |
| if: | | |
| (github.event_name == 'push' && github.ref == 'refs/heads/dev') || | |
| (github.event_name == 'workflow_dispatch' && inputs.stage == 'dev') | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| steps: | |
| - name: Call workflow_dispatch in website (dev) | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{ secrets.WSR_PAT }} | |
| script: | | |
| const isManual = context.eventName === 'workflow_dispatch'; | |
| const forceRebuild = isManual ? (context.payload.inputs.force_rebuild === true ? 'true' : 'false') : 'true'; // inputs as strings | |
| await github.rest.actions.createWorkflowDispatch({ | |
| owner: process.env.TARGET_OWNER, | |
| repo: process.env.TARGET_REPO, | |
| workflow_id: process.env.TARGET_WORKFLOW_FILE, | |
| ref: 'dev', | |
| inputs: { environment: 'dev', force_rebuild: forceRebuild } | |
| }); | |
| dispatch-prod: | |
| name: Dispatch PROD deploy | |
| if: | | |
| (github.event_name == 'release' && github.event.action == 'published') || | |
| (github.event_name == 'workflow_dispatch' && inputs.stage == 'prod') | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| steps: | |
| - name: Call workflow_dispatch in website (prod) | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{ secrets.WSR_PAT }} | |
| script: | | |
| const isManual = context.eventName === 'workflow_dispatch'; | |
| const forceRebuild = isManual ? (context.payload.inputs.force_rebuild === true ? 'true' : 'false') : 'true'; // inputs as strings | |
| await github.rest.actions.createWorkflowDispatch({ | |
| owner: process.env.TARGET_OWNER, | |
| repo: process.env.TARGET_REPO, | |
| workflow_id: process.env.TARGET_WORKFLOW_FILE, | |
| ref: 'main', | |
| inputs: { environment: 'prod', force_rebuild: forceRebuild } | |
| }); |