Single Workflow (for development and staging environments) #7
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
| # Beginning with feedback from here: https://github.com/orgs/community/discussions/197301#discussioncomment-17108233 | |
| # I am going to modify this workflow (which I created by copying the workflow-3.yml file) to be for the production environment, | |
| # to follow the pattern described in the link above. | |
| name: Single Workflow (for development and staging environments) | |
| # Controls when the workflow will run | |
| on: | |
| push: # This used to be pull_request | |
| branches: [ "main" ] # Technically, this may be all that's necessary with GitHub Flow | |
| paths-ignore: | |
| - '.github/workflows/**' | |
| workflow_dispatch: # manual | |
| inputs: | |
| environment: | |
| description: 'Environment to deploy to' | |
| required: true | |
| default: 'development' | |
| type: choice | |
| options: | |
| - development | |
| - staging | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| development-deploy: | |
| if: github.event.inputs.environment == 'development' # github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| environment: development | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v6 | |
| # Runs a single command using the runners shell | |
| - name: Print value from ENVIRONMENT | |
| run: echo ${{ vars.DISPLAY_TEXT }} | |
| staging-deploy: | |
| if: github.event.inputs.environment == 'staging' # github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| environment: staging | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v6 | |
| # Runs a single command using the runners shell | |
| - name: Print value from ENVIRONMENT | |
| run: echo ${{ vars.DISPLAY_TEXT }} |