wip #29
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 | |
- 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 | |
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 | |
cat config.json >> $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: download config | |
id: download | |
uses: actions/download-artifact@v4 | |
with: | |
name: config | |
- name: get the config outputs | |
run: | | |
configPath=${{ needs.read.outputs.configPath }} | |
configFile=$configPath/config.json | |
echo 'configFile: ' $configFile | |
ls -R >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
cat $configFile >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
# See here for deleting artifacts: https://github.com/actions/upload-artifact/issues/550 |