Skip to content

Commit 74abb5f

Browse files
authored
Merge pull request #1 from wellcode-ai/fix/build
feat(workflow): add GitHub Actions workflow for build and release process to automate deployment and versioning
2 parents 3c1fe07 + af88cde commit 74abb5f

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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 }}

0 commit comments

Comments
 (0)