Demo Workflow #8
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: Demo Workflow | |
run-name: Demo Workflow | |
on: | |
push: | |
branches: | |
- main | |
env: | |
ENV: "This is an environment variable" | |
SEC: ${{ secrets.DEMO}} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
outputs: | |
hello: ${{ steps.hello.outputs.hello }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: npm ci | |
- name: Test | |
run: npm test | |
- name: Create Hello.txt | |
run: echo "Hello, World!" > Hello.txt | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Hello | |
path: ./Hello.txt | |
- name: Creating an Output | |
id: hello | |
run: echo "::set-output name=hello::Hello, World!" | |
echo: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: Hello | |
- name: Print Hello | |
run: cat Hello.txt | |
- name: Output the Output | |
run: echo "The output is ${{ needs.test.outputs.hello }}" | |
- name: Echo Env | |
run: echo $env.ENV | |
- name: Echo Secret | |
run: echo $env.SEC |