Skip to content

Commit 73272e6

Browse files
Prachi Shivanand AnurePrachi Shivanand Anure
authored andcommitted
added common steps
1 parent 5ab469f commit 73272e6

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
tags:
8-
- "v[0-9]+.[0-9]+.[0-9]+*"
97
pull_request:
108
branches:
119
- main
@@ -15,17 +13,15 @@ concurrency:
1513
cancel-in-progress: true
1614

1715
jobs:
18-
build-and-test:
16+
common-steps:
1917
runs-on: ubuntu-latest
18+
outputs:
19+
common-dependencies: ${{ steps.common-steps.outputs.deps }}
2020
permissions:
2121
contents: write # needed to push coverage to gh-pages
2222
pull-requests: write # needed to comment on PRs
2323

24-
strategy:
25-
matrix:
26-
go-version: ["1.24.5"]
27-
fail-fast: false
28-
24+
write-all: true # necessary for release creation and publishing
2925
steps:
3026
- name: Checkout code
3127
uses: actions/checkout@v5
@@ -53,9 +49,15 @@ jobs:
5349
go mod tidy
5450
make deps
5551
56-
- name: Check code formatting
57-
run: make fmt
52+
build-and-test:
53+
needs: common-steps
54+
runs-on: ubuntu-latest
55+
strategy:
56+
matrix:
57+
go-version: ["1.24.5"]
58+
fail-fast: false
5859

60+
steps:
5961
- name: Run unit tests
6062
run: make test
6163

@@ -76,8 +78,7 @@ jobs:
7678
./scripts/publishCoverage.sh
7779
7880
release:
79-
needs: build-and-test
80-
permissions: write-all
81+
needs: common-steps
8182
runs-on: ubuntu-latest
8283

8384
strategy:

scripts/publishCoverage.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ curl -s "https://img.shields.io/badge/coverage-${NEW_COVERAGE}%25-${BADGE_COLOR}
8787

8888
# Result message
8989
if (( $(echo "$OLD_COVERAGE > $NEW_COVERAGE" | bc -l) )); then
90-
RESULT_MESSAGE="Coverage decreased from **$OLD_COVERAGE%** → **$NEW_COVERAGE%**"
90+
RESULT_MESSAGE=":red_circle: Coverage decreased from $OLD_COVERAGE% to $NEW_COVERAGE%"
9191
elif (( $(echo "$OLD_COVERAGE == $NEW_COVERAGE" | bc -l) )); then
92-
RESULT_MESSAGE="Coverage remained the same at **$NEW_COVERAGE%**"
92+
RESULT_MESSAGE=":thumbsup: Coverage remained same at $NEW_COVERAGE%"
9393
else
94-
RESULT_MESSAGE="Coverage increased from **$OLD_COVERAGE%** → **$NEW_COVERAGE%**"
94+
RESULT_MESSAGE=":thumbsup: Coverage increased from $OLD_COVERAGE% to $NEW_COVERAGE%"
9595
fi
9696

9797
# Push to gh-pages (only on push)

0 commit comments

Comments
 (0)