Hello World CI #88
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: Hello World CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - staging | |
| - dev | |
| push: | |
| branches: | |
| - main | |
| - staging | |
| - dev | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| schedule: | |
| - cron: "0 6 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| dump_context: | |
| description: Print GH context | |
| type: boolean | |
| default: false | |
| env: | |
| SOME_VAR: "some value" | |
| SOME_SECRET: ${{ secrets.SAMPLE_SECRET }} | |
| jobs: | |
| hello-world: | |
| name: Hello World | |
| runs-on: ubuntu-latest | |
| env: | |
| SOME_OTHER_VAR: "some other value" | |
| steps: | |
| - name: Say Hello | |
| run: echo "Hello World!" | |
| - name: Use var | |
| run: echo ${{ env.SOME_VAR }} | |
| - name: Use secret | |
| run: | | |
| echo secret SAMPLE_SECRET = ${{ secrets.SAMPLE_SECRET }} | |
| echo env SOME_SECRET = ${{ env.SOME_SECRET }} | |
| - name: Use other var | |
| run: echo ${{ env.SOME_OTHER_VAR }} | |
| - name: Yet another var | |
| env: | |
| YET_ANOTHER_VAR: "yet another value" | |
| run: echo ${{ env.YET_ANOTHER_VAR }} | |
| hello-again: | |
| name: Hello Again | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Say Hello | |
| run: echo "Hello Again World!" | |
| conditional-job: | |
| needs: hello-world | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: optional step | |
| if: ${{ github.event.inputs.dump_context == 'true' }} | |
| env: | |
| GITHUB_CONTEXT: ${{ toJson(github) }} | |
| run: | | |
| echo "Github context printed below" | |
| echo "$GITHUB_CONTEXT" |