diff --git a/.github/actions/hello-world/action.yml b/.github/actions/hello-world/action.yml index ff80e8b..c4dd120 100644 --- a/.github/actions/hello-world/action.yml +++ b/.github/actions/hello-world/action.yml @@ -10,6 +10,6 @@ runs: steps: - name: Say Hello run: | - echo MY_BAR=42>> $GITHUB_ENV + echo MY_BAR=super.war>> $GITHUB_ENV echo "Hello ${{ inputs.yourname }}" shell: bash diff --git a/.github/actions/write-summary/action.yml b/.github/actions/write-summary/action.yml new file mode 100644 index 0000000..3451dae --- /dev/null +++ b/.github/actions/write-summary/action.yml @@ -0,0 +1,33 @@ +name: 'write-summary' +description: 'Write Step Summary of a Deployment' +inputs: + artifact-name: + description: 'Artifact Name' + required: true + artifact-version: + description: 'Artifact Version' + required: true + artifact-checksum: + description: 'SHA Sum' + required: true + successful: + description: 'Was the deployment successful?' + required: true + +runs: + using: "composite" + steps: + - name: Summary Header Success + if: ${{inputs.successful}} + shell: bash + run: | + envsubst < .github/summary-header.md >> $GITHUB_STEP_SUMMARY + echo "| ${{inputs.artifact-name}} | ${{inputs.artifact-version }} | ${{inputs.artifact-checksum }} | 🟢 |" >> $GITHUB_STEP_SUMMARY + - name: Summary Header Failure + if: ${{inputs.successful}} + shell: bash + run: | + envsubst < .github/summary-header.md >> $GITHUB_STEP_SUMMARY + echo "| ${{inputs.artifact-name}} | ${{inputs.artifact-version }} | ${{inputs.artifact-checksum }} | 🔴 |" >> $GITHUB_STEP_SUMMARY + + diff --git a/.github/summary-header.md b/.github/summary-header.md index 32b72c0..25853cd 100644 --- a/.github/summary-header.md +++ b/.github/summary-header.md @@ -1,6 +1,2 @@ -## Deployment Summary - -Version: ${MY_VERSION} - -| Artifact | Smoke Test | -|---------------|-----------| +| Artifact | Version | Checksum | Deployment | Smoke Test | +|---------------|---------|----------|-------------|------------| \ No newline at end of file diff --git a/.github/workflows/anatomy.yml b/.github/workflows/anatomy.yml index 1760651..63ff888 100644 --- a/.github/workflows/anatomy.yml +++ b/.github/workflows/anatomy.yml @@ -31,20 +31,25 @@ jobs: uses: './.github/actions/hello-world' with: yourname: 'Toni' - - name: Number 1 + - name: small shell: bash run: | - export MY_FOO=BAR - envsubst < .github/summary-header.md >> $GITHUB_STEP_SUMMARY - echo "| $MY_FOO | 🟢 |" >> $GITHUB_STEP_SUMMARY - echo "| $MY_BAR | 🟢 |" >> $GITHUB_STEP_SUMMARY - echo "| ${{env.MY_BAR}} | 🟢 |" >> $GITHUB_STEP_SUMMARY - - name: Number 2 - shell: bash - run: | - echo Other: ${MY_FOO} - echo From Action: ${MY_BAR} - echo "| $MY_BAR | 🟢 |" >> $GITHUB_STEP_SUMMARY + echo SHA1=ABC>> $GITHUB_ENV + - name: summary + uses: './.github/actions/write-summary' + with: + artifact-name: "foo" + artifact-checksum: ${{env.SHA1}} + artifact-version: "1.0.0" + successful: true + - name: summary2 + uses: './.github/actions/write-summary' + with: + artifact-name: "other" + artifact-checksum: ${SHA1} + artifact-version: "1.0.0" + successful: false +