Skip to content

Commit e4fa90a

Browse files
author
Brian Wiborg
committed
πŸ’š Introduce automated builds
1 parent f2bf067 commit e4fa90a

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

β€Ž.github/workflows/build.ymlβ€Ž

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build and Release Ziina
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write # Needed to create releases
13+
14+
jobs:
15+
build:
16+
name: Build for ${{ matrix.goos }} ${{ matrix.goarch }}
17+
runs-on: ubuntu-latest
18+
19+
strategy:
20+
matrix:
21+
goos: [linux, darwin]
22+
goarch: [amd64, arm64]
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: '1.24.2'
32+
33+
- name: Build binary
34+
env:
35+
GOOS: ${{ matrix.goos }}
36+
GOARCH: ${{ matrix.goarch }}
37+
run: |
38+
mkdir -p dist
39+
BIN_NAME="ziina-${GOOS}-${GOARCH}"
40+
GOOS=${GOOS} GOARCH=${GOARCH} go build -o dist/$BIN_NAME .
41+
echo "BIN_NAME=$BIN_NAME" >> $GITHUB_ENV
42+
43+
- name: Upload artifact
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: ${{ env.BIN_NAME }}
47+
path: dist/${{ env.BIN_NAME }}
48+
49+
release:
50+
name: Create GitHub Release
51+
needs: build
52+
if: startsWith(github.ref, 'refs/tags/')
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- name: Download artifacts
57+
uses: actions/download-artifact@v4
58+
with:
59+
path: artifacts
60+
61+
- name: Create Release
62+
uses: softprops/action-gh-release@v2
63+
with:
64+
name: Ziina ${{ github.ref_name }}
65+
tag_name: ${{ github.ref_name }}
66+
files: artifacts/**/*
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+

0 commit comments

Comments
Β (0)