Trigger All Workflows #29
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 All Workflows | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branchOrCommit: | |
| description: 'Branch or commit SHA to deploy' | |
| required: false | |
| type: string | |
| skipDeploy: | |
| description: 'Skip deployment to ECS' | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| id-token: write | |
| contents: write | |
| actions: write | |
| jobs: | |
| trigger: | |
| runs-on: ubuntu-latest | |
| env: | |
| SELECTED_REF: ${{ inputs.branchOrCommit != '' && inputs.branchOrCommit || github.sha }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG_PREFIX: prod- | |
| steps: | |
| - name: Checkout prod branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ env.SELECTED_REF }} | |
| - name: Create and push new date-based tag | |
| run: | | |
| echo ${{ env.SELECTED_REF }} | |
| export TZ="America/New_York" | |
| tag_name="deploy-$(date +"%Y-%m-%d_%H-%M-%S")" | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git tag "$tag_name" ${{ env.SELECTED_REF }} | |
| git push origin "$tag_name" | |
| - name: Trigger Workflow 1 | |
| run: | | |
| gh workflow run deploytest.yml \ | |
| --ref master \ | |
| --field skipDeploy=${{ inputs.skipDeploy }} \ | |
| --field branchOrCommit=${{ env.SELECTED_REF }} |