Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 473cd1a

Browse files
committed
Revert "Split coverage and deploy jobs in static.yml to avoid env issue"
This reverts commit 0f14077.
1 parent f8c1853 commit 473cd1a

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

.github/workflows/static.yml

+11-23
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,27 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
jobs:
19-
coverage:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/checkout@v4
23-
- uses: actions/setup-go@v5
24-
with:
25-
go-version-file: ./go.mod
26-
- run: |
27-
./ci/test.sh
28-
echo "PERCENT=$(go tool cover -func ./ci/out/coverage.prof | tail -n1 | awk '{print $3}' | tr -d '%')" >> "$GITHUB_OUTPUT"
29-
{
30-
echo "HTML<<EOF"
31-
cat ./ci/out/coverage.html
32-
echo EOF
33-
} >> "$GITHUB_OUTPUT"
34-
3519
deploy:
3620
environment:
3721
name: github-pages
3822
url: ${{ steps.deployment.outputs.page_url }}
3923
runs-on: ubuntu-latest
40-
needs: coverage
4124
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
4227
- name: Setup Pages
4328
uses: actions/configure-pages@v5
44-
- name: Write coverage.html and coverage.svg
45-
env:
46-
PERCENT: ${{ steps.coverage.outputs.PERCENT }}
47-
HTML: ${{ steps.coverage.outputs.HTML }}
29+
- name: Setup Go
30+
uses: actions/setup-go@v5
31+
with:
32+
go-version-file: ./go.mod
33+
- name: Generate coverage and badge
4834
run: |
35+
./ci/test.sh
4936
mkdir -p ./ci/out/static
50-
wget -O ./ci/out/static/coverage.svg "https://img.shields.io/badge/coverage-${PERCENT}%25-success"
51-
echo "$HTML" > ./ci/out/static/coverage.html
37+
cp ./ci/out/coverage.html ./ci/out/static/coverage.html
38+
percent=$(go tool cover -func ./ci/out/coverage.prof | tail -n1 | awk '{print $3}' | tr -d '%')
39+
wget -O ./ci/out/static/coverage.svg "https://img.shields.io/badge/coverage-${percent}%25-success"
5240
- name: Upload artifact
5341
uses: actions/upload-pages-artifact@v3
5442
with:

0 commit comments

Comments
 (0)