wip, info and outputs #22
This file contains 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: Hi Mascot | |
on: push | |
# global env var | |
env: | |
mascot: Mona | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
windows_job: | |
name: Windows Job | |
runs-on: ubuntu-latest | |
outputs: | |
artifactId: ${{ steps.config.outputs.artifactId }} | |
steps: | |
- name: uses wf env | |
run: echo 'Hi ${{ env.mascot }}' # Hi Mona | |
- name: uses step env | |
run: echo 'Hi ${{ env.mascot }}' # Hi Octocat | |
env: | |
mascot: Octocat | |
# - name: generate config block | |
# id: config | |
# run: | | |
# echo '{"mascot": "Octocat"}' > config.json | |
- name: checkout local repo for actions | |
uses: actions/checkout@v4 | |
- name: create and upload config object | |
id: config | |
uses: ./actions/example-config-updater | |
- name: read the outputs | |
run: | | |
echo '::notice::config: ${{ steps.config.outputs.config }}' | |
echo '::notice::art: ${{ steps.config.outputs.artifactId }}' | |
echo '::notice::test: ${{ steps.config.outputs.test }}' | |
echo "::notice::env: $ARTIFACT_ID" | |
- name: set outputs | |
run: echo "ARTIFACT_ID=${{ steps.config.outputs.artifactId }} >> $GITHUB_OUTPUT" | |
linux_job: | |
name: Linux Job | |
runs-on: ubuntu-latest | |
needs: windows_job | |
env: | |
mascot: Tux | |
# outputs: | |
# mascot: ${{ steps.outstep.outputs.mascot }} | |
steps: | |
- name: try reading env from previous job | |
run: | | |
echo "notice::scope id: $ARTIFACT_ID" | |
echo '::notice::context id: ${{ env.ARTIFACT_ID }}' | |
echo '::notice::output id: ${{ needs.windows_job.outputs.artifactId}}' | |
# - name: set gritty env var | |
# run: echo "mascot=Gritty" >> $GITHUB_ENV | |
# - name: uses changed job env | |
# run: echo 'Hi ${{ env.mascot }}' # Hi Gritty | |
# - name: uses step env | |
# run: echo "Hi ${{ env.mascot }}" # Hi Mika | |
# env: | |
# mascot: Mika | |
# - name: uses job env again | |
# run: echo 'Hi ${{ env.mascot }}' # Hi Gritty | |
# - name: set output using job env | |
# id: outstep # <-- note the ID here, needed for the output definition | |
# run: echo "mascot=$mascot" >> $GITHUB_OUTPUT # Gritty | |
# macos_job: | |
# name: macOS Job | |
# runs-on: ubuntu-latest | |
# needs: [windows_job, linux_job] | |
# steps: | |
# - name: global env var not changed by previous job | |
# run: echo 'Hi ${{ env.mascot }}' # Hi Mona | |
# - name: Use prior job output to pass data around | |
# run: echo 'Hi ${{ needs.linux_job.outputs.mascot }}' # Hi Gritty |