missed a content #34
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: ConfigHelper | |
on: push | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
init: | |
name: Init | |
runs-on: ubuntu-latest | |
outputs: | |
artifactId: ${{ steps.create.outputs.artifactId }} | |
steps: | |
- name: init | |
run: echo 'starting ${{ github.job }}' | |
- name: checkout app repo | |
uses: actions/checkout@v4 | |
# should only be needed in this POC | |
- name: stash action dir | |
uses: actions/upload-artifact@v4 | |
with: | |
name: actions | |
path: actions | |
# creates implied output: artifactId | |
- name: create the example config object | |
id: create | |
uses: ./actions/example-config-updater | |
with: | |
mode: create | |
config: '{"config": "from init"}' | |
- name: test using env var | |
run: | | |
echo "config from env: $CONFIG" >> $GITHUB_STEP_SUMMARY | |
- name: test using step outputs | |
run: | | |
echo "config from step: ${{ steps.create.outputs.config }}" >> $GITHUB_STEP_SUMMARY | |
read: | |
name: Read | |
runs-on: ubuntu-latest | |
needs: [init] | |
outputs: | |
configPath: ${{ steps.download.outputs.download-path }} | |
steps: | |
- name: unstash action dir | |
uses: actions/download-artifact@v4 | |
with: | |
name: actions | |
path: actions | |
- name: read config | |
id: read | |
uses: ./actions/example-config-updater | |
with: | |
mode: read | |
artifactId: ${{ needs.init.outputs.artifactId }} | |
# - name: download config | |
# id: download | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: config | |
- name: print config to summary | |
run: | | |
echo 'config:' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
echo $CONFIG >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
update: | |
name: Update | |
runs-on: ubuntu-latest | |
needs: [read] | |
steps: | |
- name: unstash action dir | |
uses: actions/download-artifact@v4 | |
with: | |
name: actions | |
path: actions | |
- name: update config | |
id: read | |
uses: ./actions/example-config-updater | |
with: | |
mode: write | |
artifactId: ${{ needs.init.outputs.artifactId }} | |
config: '{"neo": "anderson"}' | |
- name: print config to summary | |
run: | | |
echo 'config:' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
echo $CONFIG >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
# See here for deleting artifacts: https://github.com/actions/upload-artifact/issues/550 |