-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 1.9 KB
/
build-and-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
65
66
67
68
69
name: Build and Release
on:
push:
branches:
- "*"
tags:
- "*"
permissions:
contents: write
env:
LINUX_AMD_ARCHIVE: sourceprompt-${{ github.ref_name }}-linux-amd64.tar.gz
LINUX_ARM_ARCHIVE: sourceprompt-${{ github.ref_name }}-linux-arm64.tar.gz
WIN_AMD_ARCHIVE: sourceprompt-${{ github.ref_name }}-win-amd64.zip
MAC_ARM_ARCHIVE: sourceprompt-${{ github.ref_name }}-mac-arm64.tar.gz
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22.0
- name: Build Binaries
id: build
run: |
echo "ref -> $GITHUB_REF"
echo "----- Building Linux amd64 binary"
GOOS=linux GOARCH=amd64 go build -o sourceprompt .
tar -czvf ${LINUX_AMD_ARCHIVE} sourceprompt
rm -v sourceprompt
echo "----- Building Linux arm64 binary"
GOOS=linux GOARCH=arm64 go build -o sourceprompt .
tar -czvf ${LINUX_ARM_ARCHIVE} sourceprompt
rm -v sourceprompt
echo "----- Building Windows amd64 binary"
GOOS=windows GOARCH=amd64 go build -o sourceprompt.exe .
zip ${WIN_AMD_ARCHIVE} sourceprompt.exe
rm -v sourceprompt.exe
echo "----- Building Mac arm64 binary"
GOOS=darwin GOARCH=arm64 go build -o sourceprompt .
tar -czvf ${MAC_ARM_ARCHIVE} sourceprompt
rm -v sourceprompt
ls -lah
- name: Create Release and Upload Artifacts
if: startsWith(github.ref, 'refs/tags/')
id: create_release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: "sourceprompt ${{ github.ref_name }}"
files: |
*.tar.gz
*.zip