Parse Workflow Environment Action
Github action that looks through the github environment variables and creates flags for use in the workflow. See outputs in action.yml for a list of available flags.
Usage
Simple Usage
steps:
- uses: Brightspace/actions-parse-workflow-env@v1
id: workflow-env
- name: Deploy
if: ${{ steps.workflow-env.outputs.isRelease == 'true' }}
run: do deploy
Custom Release Tag
steps:
- uses: Brightspace/actions-parse-workflow-env@v1
id: workflow-env
with:
release-tag-prefix: 'rel.v.'
- name: Deploy
if: ${{ steps.workflow-env.outputs.isRelease == 'true' }}
run: do deploy
Main as default branch
By default the main branch is 'master'. If you have migrated to 'main' as the main branch, or use an unconventional main branch, you will have to set the main-branch.
steps:
- uses: Brightspace/actions-parse-workflow-env@v1
id: workflow-env
with:
main-branch: 'main'
- name: Deploy UAT
if: ${{ steps.workflow-env.outputs.isMain == 'true' }}
run: do deploy
Use in multiple jobs
jobs:
Workflow-Env:
outputs:
isMain: ${{ steps.workflowEnv.outputs.isMain }}
isSchedule: ${{ steps.workflowEnv.outputs.isSchedule }}
isPush: ${{ steps.workflowEnv.outputs.isPush }}
isTagged: ${{ steps.workflowEnv.outputs.isTagged }}
isRelease: ${{ steps.workflowEnv.outputs.isRelease }}
steps:
- name: Setup Workflow Env
id: workflowEnv
uses: Brightspace/actions-parse-workflow-env@v1
Deploy:
needs: [Workflow-Env]
if: ${{ needs.Workflow-env.outputs.isMain == 'true' }}
steps:
- name: Do Deploy
run: do deploy