Skip to content

Commit 16575f6

Browse files
committed
chore: add basic build, test, and release actions
Add basic github actions to build, test, and generate release artifacts for `gptscript`. Includes goreleaser configuration to publish homebrew Formulas to our [tap repository](https://github.com/gptscript-ai/homebrew-tap/). Signed-off-by: Nick Hale <[email protected]>
1 parent 4c8085a commit 16575f6

File tree

4 files changed

+162
-0
lines changed

4 files changed

+162
-0
lines changed

.github/workflows/main.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: main
2+
3+
concurrency:
4+
group: main
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
release-snapshot:
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
- name: Set up Go
24+
uses: actions/setup-go@v4
25+
with:
26+
cache: false
27+
go-version: "1.21"
28+
- name: Run GoReleaser
29+
uses: goreleaser/goreleaser-action@v4
30+
with:
31+
distribution: goreleaser
32+
version: v1.23.0
33+
args: release --clean --snapshot
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
GH_PROJECT_TOKEN: ${{ secrets.GH_PROJECT_TOKEN }}

.github/workflows/release.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release-tag:
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
cache: false
23+
go-version: "1.21"
24+
- name: Run GoReleaser
25+
uses: goreleaser/goreleaser-action@v4
26+
with:
27+
distribution: goreleaser
28+
version: v1.23.0
29+
args: release --rm-dist
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
GH_PROJECT_TOKEN: ${{ secrets.GH_PROJECT_TOKEN }}
33+
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}

.github/workflows/test.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: test
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 1
17+
- uses: actions/setup-go@v4
18+
with:
19+
cache: false
20+
go-version: "1.21"
21+
- name: Validate
22+
run: make validate
23+
- name: Build
24+
run: make build
25+
- name: Run Tests
26+
run: make test

.goreleaser.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
dist: releases
2+
snapshot:
3+
name_template: '{{ trimprefix .Summary "v" }}'
4+
5+
builds:
6+
- id: default
7+
binary: gptscript
8+
env:
9+
- CGO_ENABLED=0
10+
goarch:
11+
- amd64
12+
- arm64
13+
ignore:
14+
- goos: windows
15+
goarch: arm64
16+
flags:
17+
- -trimpath
18+
ldflags:
19+
- -s
20+
- -w
21+
- -X "github.com/gptscript-ai/gptscript/pkg/version.Tag=v{{ .Version }}"
22+
23+
universal_binaries:
24+
- id: mac
25+
ids:
26+
- default
27+
replace: true
28+
29+
archives:
30+
- id: default
31+
builds:
32+
- default
33+
- mac
34+
name_template: '{{.Project}}-v{{ .Version }}-{{ if eq .Os "darwin" }}macOS-universal{{ else }}{{ .Os }}-{{ .Arch }}{{ .Arm }}{{ end }}'
35+
format_overrides:
36+
- goos: windows
37+
format: zip
38+
39+
checksum:
40+
name_template: "checksums.txt"
41+
42+
changelog:
43+
use: github
44+
sort: asc
45+
filters:
46+
exclude:
47+
- "^docs:"
48+
- "^test:"
49+
- "^Merge pull request"
50+
51+
release:
52+
github:
53+
owner: gptscript-ai
54+
name: gptscript
55+
prerelease: auto
56+
57+
brews:
58+
- description: "GPTScript CLI"
59+
install: |
60+
bin.install "gptscript"
61+
homepage: "https://github.com/gptscript-ai/gptscript"
62+
skip_upload: false
63+
folder: "Formula"
64+
repository:
65+
owner: gptscript-ai
66+
name: homebrew-tap
67+
token: "{{ .Env.GH_PROJECT_TOKEN }}"

0 commit comments

Comments
 (0)