generated from LordPax/cli-template
-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (53 loc) · 1.37 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Build and Test
permissions:
contents: write
on:
push:
tags:
- 'v*'
jobs:
build:
strategy:
matrix:
os: [ linux, windows, darwin ]
arch: [ amd64, arm64, 386 ]
exclude:
- os: windows
arch: arm64
- os: darwin
arch: 386
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.2'
- name: Install dependencies
run: go get .
- run: |
mkdir aicli
cp README.md install.sh CHANGELOG.md aicli
- name: Build
run: |
name="aicli"
if [ "${{ matrix.os }}" = "windows" ]; then
name="${name}.exe"
fi
GOARCH=${{ matrix.arch }} GOOS=${{ matrix.os }} go build -o "aicli/${name}" .
- name: Archive
run: |
tar -czf \
aicli-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}.tar.gz aicli
- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body_path: CHANGELOG.md
draft: false
prerelease: false
files: |
aicli-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}.tar.gz