1+ name : Master
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ workflow_dispatch :
8+
9+ jobs :
10+
11+ build :
12+ name : Tag
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+ with :
18+ token : ${{ secrets.PAT_TAG }}
19+ # https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow
20+ # https://stackoverflow.com/questions/57921401/push-to-origin-from-github-action
21+
22+ - name : Extract Tag
23+ run : |
24+ set -ex
25+ COMMIT_MESSAGE=$(git log -n 1 --pretty=format:%s)
26+ TAG=$(echo $COMMIT_MESSAGE | sed -nE 's/^(Release|release) ([0-9]+\.[0-9]+\.[0-9]+) \(#[0-9]+\)$/\2/p')
27+
28+ if [ -z "$TAG" ]; then
29+ echo "::error::The release version can't be found into the commit message!" && exit 1
30+ else
31+ echo "TAG=$TAG" >> $GITHUB_ENV
32+ fi
33+
34+ - name : Create Tag
35+ run : |
36+ set -ex
37+ git config user.name "github-actions"
38+ git config user.email "[email protected] " 39+ git tag -a v$TAG -m "Release $TAG"
40+ git push --follow-tags
41+
42+
43+ report :
44+ name : Codecov
45+ runs-on : ubuntu-latest
46+ permissions :
47+ contents : read
48+ pull-requests : read
49+ steps :
50+ - name : Checkout code
51+ uses : actions/checkout@v4
52+
53+ - name : Set up Go
54+ uses : actions/setup-go@v5
55+ with :
56+ go-version-file : ' go.mod'
57+ cache : true
58+
59+ - name : Install dependencies
60+ run : |
61+ go mod download
62+ go install github.com/jstemmer/go-junit-report/v2@latest
63+
64+ - name : Run all tests
65+ run : |
66+ set -e
67+ . ./scripts/testacc.env
68+ ./scripts/testacc.sh setup
69+ go test -v -coverprofile=coverage.out ./internal/provider/... | go-junit-report -set-exit-code > junit.xml
70+ ./scripts/testacc.sh cleanup
71+
72+ - name : Upload test results to Codecov
73+ uses : codecov/test-results-action@v1
74+ with :
75+ token : ${{ secrets.CODECOV_TOKEN }}
76+
77+ - name : Upload coverage reports to Codecov
78+ uses : codecov/codecov-action@v5
79+ with :
80+ verbose : true
81+ token : ${{ secrets.CODECOV_TOKEN }}
82+ slug : rfd59/terraform-provider-rabbitmq
0 commit comments