From 170cef04c88f1f44e0180a5b4fe11f40bf4e7e5f Mon Sep 17 00:00:00 2001 From: Halstein Tonheim Date: Mon, 27 Oct 2025 09:51:15 +0100 Subject: [PATCH 1/5] Added outputs demo --- .github/workflows/outputs-demo | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/outputs-demo diff --git a/.github/workflows/outputs-demo b/.github/workflows/outputs-demo new file mode 100644 index 0000000..b6465af --- /dev/null +++ b/.github/workflows/outputs-demo @@ -0,0 +1,82 @@ +name: Outputs Demo + +on: + - push + +jobs: + info: + name: info + runs-on: ubuntu-latest + outputs: + commit-sha: ${{ steps.commit.outputs.sha }} + branch-name: ${{ steps.branch.outputs.branch }} + commit-message: ${{ steps.message.outputs.message }} + steps: + - name: Checkout repository + uses: actions/checkout@v5 + - name: Get commit SHA + id: commit + run: | + SHA=$(git rev-parse --short HEAD) + echo "sha=$SHA" >> $GITHUB_OUTPUT + # Get current branch name + - name: Get branch name + id: branch + run: | + BRANCH=$(git rev-parse --abbrev-ref HEAD) + echo "branch=$BRANCH" >> $GITHUB_OUTPUT + # Get the commit message + - name: Get commit message + id: message + run: | + MESSAGE=$(git log -1 --pretty=%B) + echo "message=$MESSAGE" >> $GITHUB_OUTPUT + + build: + name: Build Project + runs-on: ubuntu-latest + outputs: + build-report: ${{ steps.report.outputs.content }} + steps: + # Remember we have to check out the repository first! + - name: Checkout repository + uses: actions/checkout@v5 + + # This step installs the dependencies + - name: Install dependencies + run: npm ci + + - name: Print build info + run: | + echo "Building commit ${{ needs.info.outputs.commit-sha }} on branch ${{ needs.info.outputs.branch-name }}" + + - name: Generate build report + id: report + run: | + { + echo "content<> $GITHUB_OUTPUT + + - name: Build + run: npm run build + + summary: + name: Summary + runs-on: ubuntu-latest + needs: [info, build] + steps: + - name: Print summary + run: | + echo "## Build Summary" + echo "" + echo "- **Commit SHA:** ${{ needs.info.outputs.commit-sha }}" + echo "- **Branch Name:** ${{ needs.info.outputs.branch-name }}" + echo "- **Commit Message:** ${{ needs.info.outputs.commit-message }}" + echo "" + echo "${{ needs.build.outputs.build-report }}" From eb790b5bcd927fc517b7f05ca59dd3ca235d0578 Mon Sep 17 00:00:00 2001 From: Halstein Tonheim Date: Mon, 27 Oct 2025 10:00:00 +0100 Subject: [PATCH 2/5] Fix output demo --- .github/workflows/outputs-demo | 86 +++++++++++++++++----------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/workflows/outputs-demo b/.github/workflows/outputs-demo index b6465af..4ef3782 100644 --- a/.github/workflows/outputs-demo +++ b/.github/workflows/outputs-demo @@ -32,51 +32,51 @@ jobs: MESSAGE=$(git log -1 --pretty=%B) echo "message=$MESSAGE" >> $GITHUB_OUTPUT - build: - name: Build Project - runs-on: ubuntu-latest - outputs: - build-report: ${{ steps.report.outputs.content }} - steps: - # Remember we have to check out the repository first! - - name: Checkout repository - uses: actions/checkout@v5 + build: + name: Build Project + runs-on: ubuntu-latest + outputs: + build-report: ${{ steps.report.outputs.content }} + steps: + # Remember we have to check out the repository first! + - name: Checkout repository + uses: actions/checkout@v5 - # This step installs the dependencies - - name: Install dependencies - run: npm ci + # This step installs the dependencies + - name: Install dependencies + run: npm ci - - name: Print build info - run: | - echo "Building commit ${{ needs.info.outputs.commit-sha }} on branch ${{ needs.info.outputs.branch-name }}" + - name: Print build info + run: | + echo "Building commit ${{ needs.info.outputs.commit-sha }} on branch ${{ needs.info.outputs.branch-name }}" - - name: Generate build report - id: report - run: | - { - echo "content<> $GITHUB_OUTPUT + - name: Generate build report + id: report + run: | + { + echo "content<> $GITHUB_OUTPUT - - name: Build - run: npm run build + - name: Build + run: npm run build - summary: - name: Summary - runs-on: ubuntu-latest - needs: [info, build] - steps: - - name: Print summary - run: | - echo "## Build Summary" - echo "" - echo "- **Commit SHA:** ${{ needs.info.outputs.commit-sha }}" - echo "- **Branch Name:** ${{ needs.info.outputs.branch-name }}" - echo "- **Commit Message:** ${{ needs.info.outputs.commit-message }}" - echo "" - echo "${{ needs.build.outputs.build-report }}" + summary: + name: Summary + runs-on: ubuntu-latest + needs: [info, build] + steps: + - name: Print summary + run: | + echo "## Build Summary" + echo "" + echo "- **Commit SHA:** ${{ needs.info.outputs.commit-sha }}" + echo "- **Branch Name:** ${{ needs.info.outputs.branch-name }}" + echo "- **Commit Message:** ${{ needs.info.outputs.commit-message }}" + echo "" + echo "${{ needs.build.outputs.build-report }}" From 829971b46a2f7a2053f42475b4ffd7902d8732a1 Mon Sep 17 00:00:00 2001 From: Halstein Tonheim Date: Mon, 27 Oct 2025 10:01:33 +0100 Subject: [PATCH 3/5] Fix outputs demo --- .github/workflows/{outputs-demo => outputs-demo.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{outputs-demo => outputs-demo.yml} (100%) diff --git a/.github/workflows/outputs-demo b/.github/workflows/outputs-demo.yml similarity index 100% rename from .github/workflows/outputs-demo rename to .github/workflows/outputs-demo.yml From 4ea7602ba13f3ee9f0eb4b232774b38fda9f9569 Mon Sep 17 00:00:00 2001 From: Halstein Tonheim Date: Mon, 27 Oct 2025 10:02:54 +0100 Subject: [PATCH 4/5] Fix outputs demo --- .github/workflows/outputs-demo.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/outputs-demo.yml b/.github/workflows/outputs-demo.yml index 4ef3782..dbe19d4 100644 --- a/.github/workflows/outputs-demo.yml +++ b/.github/workflows/outputs-demo.yml @@ -35,6 +35,7 @@ jobs: build: name: Build Project runs-on: ubuntu-latest + needs: [info] outputs: build-report: ${{ steps.report.outputs.content }} steps: From 22c76ea8e2abba23ee1e0ef21f06cf7072b9d727 Mon Sep 17 00:00:00 2001 From: Halstein Tonheim Date: Mon, 27 Oct 2025 10:11:59 +0100 Subject: [PATCH 5/5] Fix outputs demo --- .github/workflows/outputs-demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/outputs-demo.yml b/.github/workflows/outputs-demo.yml index dbe19d4..3eadec1 100644 --- a/.github/workflows/outputs-demo.yml +++ b/.github/workflows/outputs-demo.yml @@ -35,7 +35,7 @@ jobs: build: name: Build Project runs-on: ubuntu-latest - needs: [info] + needs: info outputs: build-report: ${{ steps.report.outputs.content }} steps: