Skip to content

Add support to Node20 (#58) #59

Add support to Node20 (#58)

Add support to Node20 (#58) #59

# Summary:
# Tests the example used in README.md, to make sure the example we show is always working.
#
# See https://github.com/actions/checkout https://github.com/actions/checkout/releases/tag/v3
name: 'GitHub Action code snippet'
on:
push:
jobs:
# We want to wait for the auto-git-release-x to be done, so that we always test the MAJOR version that was just updated
await-release:
name: Sleep for 45 seconds
runs-on: ubuntu-22.04
steps:
- run: sleep 45s
shell: bash
# On some job, do some stuff and persist variables meant to be re-used in other jobs
compute-data:
name: Compute data
runs-on: ubuntu-22.04
needs: await-release
steps:
# Do your own internal business logic...
- name: Compute resources
run: |
MAGIC_NUMBER=42
echo "Found universal answer: $MAGIC_NUMBER"
echo "Exporting it as ENV variable..."
echo "MAGIC_NUMBER=$MAGIC_NUMBER" >> $GITHUB_ENV
# XXX We recommend to export all your variables at once, at the end of your job
- name: Export variable MAGIC_NUMBER for next jobs
uses: UnlyEd/github-action-store-variable@v3 # See https://github.com/UnlyEd/github-action-store-variable
with:
# Persist (store) our MAGIC_NUMBER ENV variable into our store, for the next jobs
variables: |
MAGIC_NUMBER=${{ env.MAGIC_NUMBER }}
# In another job, read the previously stored variable and use it
retrieve-data:
name: Find & re-use data
runs-on: ubuntu-22.04
needs: compute-data
steps:
- name: Import variable MAGIC_NUMBER
uses: UnlyEd/github-action-store-variable@v3 # See https://github.com/UnlyEd/github-action-store-variable
with:
# List all variables you want to retrieve from the store
# XXX They'll be automatically added to your ENV
variables: |
MAGIC_NUMBER
- name: Debug output
run: echo "We have access to $MAGIC_NUMBER"
save-many-variables-by-using-custom-delimiter:
name: Save many variables by using a custom delimiter (comma)
runs-on: ubuntu-22.04
needs: await-release
steps:
- name: Export variable for next jobs
uses: UnlyEd/github-action-store-variable@v3 # See https://github.com/UnlyEd/github-action-store-variable
with:
delimiter: ','
variables: FOO=BAR,STAGE=production
retrieve-data-saved-with-a-custom-delimiter:
name: Retrieve variables using a custom delimiter
runs-on: ubuntu-22.04
needs: save-many-variables-by-using-custom-delimiter
steps:
- name: Import variable MAGIC_NUMBER
uses: UnlyEd/github-action-store-variable@v3 # See https://github.com/UnlyEd/github-action-store-variable
with:
delimiter: ';'
variables: FOO;STAGE
failIfNotFound: true
- name: Debug output
run: echo "Found FOO=$FOO and STAGE=$STAGE"