File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and Release
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ build :
10+ name : Build and Release
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : write
14+
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v3
18+ with :
19+ fetch-depth : 0
20+
21+ - name : Set up Go
22+ uses : actions/setup-go@v4
23+ with :
24+ go-version : ' 1.21'
25+ cache : true
26+
27+ - name : Run tests
28+ run : make test
29+
30+ - name : Create distribution builds
31+ run : make dist
32+
33+ - name : Create release archives
34+ run : make release
35+
36+ - name : Get version
37+ id : get_version
38+ run : |
39+ VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "v0.1.0-$(date +'%Y%m%d%H%M%S')-$(git rev-parse --short HEAD)")
40+ echo "VERSION=$VERSION" >> $GITHUB_ENV
41+ echo "version=$VERSION" >> $GITHUB_OUTPUT
42+
43+ - name : Create GitHub Release
44+ uses : softprops/action-gh-release@v1
45+ with :
46+ name : Release ${{ env.VERSION }}
47+ tag_name : ${{ env.VERSION }}
48+ generate_release_notes : true
49+ files : |
50+ dist/*.tar.gz
51+ dist/*.zip
52+ env :
53+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments