Skip to content

Commit

Permalink
initial typescript action test
Browse files Browse the repository at this point in the history
  • Loading branch information
mcascone committed Aug 13, 2024
1 parent 30185d7 commit dda73f0
Show file tree
Hide file tree
Showing 15 changed files with 142,597 additions and 49 deletions.
103 changes: 54 additions & 49 deletions .github/workflows/envtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,59 @@ jobs:
env:
mascot: Octocat

- name: generate config block
# - 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
run: |
echo '{"mascot": "Octocat"}' > config.json
- name: Upload config.json as artifact
uses: actions/upload-artifact@v4
with:
name: config
path: config.json

linux_job:
name: Linux Job
runs-on: ubuntu-latest
needs: windows_job
env:
mascot: Tux
outputs:
mascot: ${{ steps.outstep.outputs.mascot }}
steps:
- name: uses job env
run: echo 'Hi ${{ env.mascot }}' # Hi Tux
uses: ./actions/example-config-updater

- 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
- name: read the outputs
run: |
echo 'config: ${{ steps.config.outputs.config }}'
echo 'art: ${{ steps.config.outputs.artifactId }}'
# linux_job:
# name: Linux Job
# runs-on: ubuntu-latest
# needs: windows_job
# env:
# mascot: Tux
# outputs:
# mascot: ${{ steps.outstep.outputs.mascot }}
# steps:
# - name: uses job env
# run: echo 'Hi ${{ env.mascot }}' # Hi Tux

# - 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 2 additions & 0 deletions actions/example-config-updater/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
lib
14 changes: 14 additions & 0 deletions actions/example-config-updater/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: example-config-updater

description: an example of using upload/download to pass the config object around

outputs:
config:
description: the updated config object.

artifactId:
description: the updated config object as an artifact.

runs:
using: node20
main: dist/index.js
Loading

0 comments on commit dda73f0

Please sign in to comment.