Skip to content

Commit 91a56d8

Browse files
committed
ci: add workflow to build and release binary on tag
1 parent cfcce38 commit 91a56d8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build the binary and create release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '**'
8+
9+
jobs:
10+
build-and-release:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout the repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.21'
23+
cache-dependency-path: teamup-rocketchat-bot/go.sum
24+
25+
- name: Build the binary for linux/amd64
26+
working-directory: teamup-rocketchat-bot
27+
run: |
28+
OUTPUT_NAME=teamup-rocketchat-bot-linux-amd64-${{ github.ref_name }}
29+
GOARCH=amd64 GOOS=linux go build -o build/$OUTPUT_NAME .
30+
echo "binary created with filename $(ls build/)"
31+
32+
- name: Create GitHub release and upload binary
33+
uses: softprops/action-gh-release@v2
34+
with:
35+
files: teamup-rocketchat-bot/build/teamup-rocketchat-bot-linux-amd64-${{ github.ref_name }}
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)