Skip to content

Commit

Permalink
added reusable outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
moontrip committed Jul 27, 2024
1 parent 8a64839 commit ba08fff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@ on:
required: true
default: dist
type: string
# DKDK one can add secrets
# secrets:
# some-secret:
# required: true
outputs:
result:
description: The result of the deployment operation
values: ${{ jobs.deploy.outputs.outcome }}
jobs:
deploy:
outputs:
# DKDK steps.{id value}.outputs.{variable name}
outcome: ${{ steps.set-result.outputs.step-result }}
runs-on: ubuntu-latest
steps:
- name: Get code
Expand All @@ -21,3 +32,6 @@ jobs:
run: ls
- name: Output information
run: echo "Deplying & uploading..."
- name: Set result outputs
id: set-result
run: echo "step-result=success" >> $GITHUB_OUTPUT
12 changes: 11 additions & 1 deletion .github/workflows/use-reuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,19 @@ jobs:
# - name: Deploy
# run: echo "Deploying..."
uses: ./.github/workflows/reusable.yml
# DKDK this is for resuable inputs
# DKDK this is for resuable inputs (resuable.yml)
with:
artifact-name: dist-files
# DKDK if secrets is used at resuable, we need to make an input for secrets here
# secrets:
# some-secret: ${{ secrets.some-secret}}
# DKDK print outputs that was defined at resuable.yml
print-deply-result:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Print deploy output
run: echo "${{ needs.deploy.outputs.result }}"
report:
# DKDK add failure() to run this job if previous job/step fails
needs: [lint, deploy]
Expand Down

0 comments on commit ba08fff

Please sign in to comment.