Skip to content

Commit a5e4af1

Browse files
committed
add build workflow
1 parent 26bfbab commit a5e4af1

File tree

8 files changed

+70
-0
lines changed

8 files changed

+70
-0
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: publish
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@master
11+
with:
12+
fetch-depth: 1
13+
- name: Set up Go
14+
uses: actions/setup-go@v2
15+
with:
16+
go-version: 1.22.5
17+
- name: Make all
18+
run: make all
19+
- name: Upload release binaries
20+
uses: actions/upload-artifact@v2
21+
with:
22+
name: release-binaries
23+
path: ./bin/
24+
- name: Create Release
25+
id: create_release
26+
uses: actions/create-release@v1
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
29+
with:
30+
tag_name: ${{ github.ref }}
31+
release_name: Release ${{ github.ref }}
32+
draft: false
33+
prerelease: false
34+
- name: Upload Release Asset
35+
uses: actions/upload-release-asset@v1
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
38+
with:
39+
upload_url: ${{ steps.create_release.outputs.upload_url }}
40+
asset_path: ./bin/
41+
asset_name: release-it
42+
asset_content_type: application/zip

Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Version := $(shell git describe --tags --dirty)
2+
GitCommit := $(shell git rev-parse HEAD)
3+
LDFLAGS := "-s -w -X main.Version=$(Version) -X main.GitCommit=$(GitCommit)"
4+
5+
.PHONY: all
6+
all: gofmt vendor dist
7+
8+
.PHONY: gofmt
9+
gofmt:
10+
@test -z $(shell gofmt -l ./ | tee /dev/stderr) || (echo "[WARN] Fix formatting issues with 'make fmt'" && exit 1)
11+
12+
.PHONY: vendor
13+
vendor:
14+
go mod vendor
15+
16+
.PHONY: dist
17+
dist:
18+
mkdir -p bin/
19+
CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/release-it-amd64
20+
CGO_ENABLED=0 GOOS=darwin go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/release-it-darwin
21+
GOARM=7 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/release-it-arm
22+
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/release-it-arm64
23+
GOOS=windows CGO_ENABLED=0 go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/release-it.exe
24+
25+
test:
26+
go test ./... -v -race

bin/release-it-amd64

1.69 MB
Binary file not shown.

bin/release-it-arm

1.75 MB
Binary file not shown.

bin/release-it-arm64

1.69 MB
Binary file not shown.

bin/release-it-darwin

1.74 MB
Binary file not shown.

bin/release-it.exe

1.76 MB
Binary file not shown.

vendor/modules.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# github.com/a-h/templ v0.2.747
2+
## explicit; go 1.21

0 commit comments

Comments
 (0)