From 473cd1a22a3f4540176be9cbe8ac3706dc20fdad Mon Sep 17 00:00:00 2001
From: Mathias Fredriksson <mafredri@gmail.com>
Date: Thu, 15 Aug 2024 19:57:52 +0000
Subject: [PATCH] Revert "Split coverage and deploy jobs in static.yml to avoid
 env issue"

This reverts commit 0f14077dcfa84bb22fa4f83f84d9f0444c5accfe.
---
 .github/workflows/static.yml | 34 +++++++++++-----------------------
 1 file changed, 11 insertions(+), 23 deletions(-)

diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml
index 9b89a52..bbc03b3 100644
--- a/.github/workflows/static.yml
+++ b/.github/workflows/static.yml
@@ -16,39 +16,27 @@ concurrency:
   cancel-in-progress: true
 
 jobs:
-  coverage:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4
-      - uses: actions/setup-go@v5
-        with:
-          go-version-file: ./go.mod
-      - run: |
-          ./ci/test.sh
-          echo "PERCENT=$(go tool cover -func ./ci/out/coverage.prof | tail -n1 | awk '{print $3}' | tr -d '%')" >> "$GITHUB_OUTPUT"
-          {
-            echo "HTML<<EOF"
-            cat ./ci/out/coverage.html
-            echo EOF
-          } >> "$GITHUB_OUTPUT"
-
   deploy:
     environment:
       name: github-pages
       url: ${{ steps.deployment.outputs.page_url }}
     runs-on: ubuntu-latest
-    needs: coverage
     steps:
+      - name: Checkout
+        uses: actions/checkout@v4
       - name: Setup Pages
         uses: actions/configure-pages@v5
-      - name: Write coverage.html and coverage.svg
-        env:
-          PERCENT: ${{ steps.coverage.outputs.PERCENT }}
-          HTML: ${{ steps.coverage.outputs.HTML }}
+      - name: Setup Go
+        uses: actions/setup-go@v5
+        with:
+          go-version-file: ./go.mod
+      - name: Generate coverage and badge
         run: |
+          ./ci/test.sh
           mkdir -p ./ci/out/static
-          wget -O ./ci/out/static/coverage.svg "https://img.shields.io/badge/coverage-${PERCENT}%25-success"
-          echo "$HTML" > ./ci/out/static/coverage.html
+          cp ./ci/out/coverage.html ./ci/out/static/coverage.html
+          percent=$(go tool cover -func ./ci/out/coverage.prof | tail -n1 | awk '{print $3}' | tr -d '%')
+          wget -O ./ci/out/static/coverage.svg "https://img.shields.io/badge/coverage-${percent}%25-success"
       - name: Upload artifact
         uses: actions/upload-pages-artifact@v3
         with:
-- 
GitLab