File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Release GLOS
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main # Triggers when merging a release into main
7
+ pull_request :
8
+ branches :
9
+ - dev # Runs tests on dev and feature branches
10
+ workflow_dispatch : # Allows manual triggering
11
+
12
+ jobs :
13
+ test :
14
+ name : Run Tests
15
+ runs-on : ubuntu-latest
16
+ steps :
17
+ - name : Checkout code
18
+ uses : actions/checkout@v3
19
+
20
+ - name : Set up Go
21
+ uses : actions/setup-go@v4
22
+ with :
23
+ go-version : ' 1.21' # Adjust to your Go version
24
+
25
+ - name : Run tests
26
+ run : go test ./... # Make sure you have tests in place!
27
+
28
+ release :
29
+ name : Build and Release
30
+ runs-on : ubuntu-latest
31
+ needs : test # Runs only if tests pass
32
+ if : github.ref == 'refs/heads/main'
33
+
34
+ steps :
35
+ - name : Checkout code
36
+ uses : actions/checkout@v3
37
+
38
+ - name : Set up Go
39
+ uses : actions/setup-go@v4
40
+ with :
41
+ go-version : ' 1.21'
42
+
43
+ - name : Build binary
44
+ run : |
45
+ go build -o glos main.go # Change output name if needed
46
+
47
+ - name : Archive binary
48
+ run : |
49
+ tar -czvf glos-linux-amd64.tar.gz glos
50
+ echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
51
+
52
+ - name : Create GitHub Release
53
+ uses : softprops/action-gh-release@v1
54
+ with :
55
+ tag_name : ${{ env.VERSION }}
56
+ name : " Release ${{ env.VERSION }}"
57
+ body : " Auto-generated release for version ${{ env.VERSION }}"
58
+ draft : false
59
+ prerelease : true # Mark as a pre-release if it's below 1.0.0
60
+ files : glos-linux-amd64.tar.gz
61
+ env :
62
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments