-
Notifications
You must be signed in to change notification settings - Fork 200
146 lines (121 loc) · 6.43 KB
/
main.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Build Go Project and Create Release
on:
push:
branches: [release]
permissions:
contents: write
jobs:
build_and_release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.20.x"
- name: Linux
if: matrix.os == 'ubuntu-20.04'
run: |
go build -ldflags="-s -w" -o tgpt-linux-amd64
GOARCH=386 go build -ldflags="-s -w" -o tgpt-linux-i386
GOARCH=arm64 go build -ldflags="-s -w" -o tgpt-linux-arm64
GOARCH=arm go build -ldflags="-s -w" -o tgpt-linux-arm
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o tgpt-amd64.exe
GOOS=windows GOARCH=arm go build -ldflags="-s -w" -o tgpt-arm.exe
GOOS=windows GOARCH=arm64 go build -ldflags="-s -w" -o tgpt-arm64.exe
GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o tgpt-i386.exe
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o tgpt-mac-amd64
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o tgpt-mac-arm64
GOOS=netbsd GOARCH=amd64 go build -ldflags="-s -w" -o tgpt-netbsd-amd64
GOOS=netbsd GOARCH=arm64 go build -ldflags="-s -w" -o tgpt-netbsd-arm64
GOOS=netbsd GOARCH=arm go build -ldflags="-s -w" -o tgpt-netbsd-arm
GOOS=netbsd GOARCH=386 go build -ldflags="-s -w" -o tgpt-netbsd-i386
GOOS=freebsd GOARCH=amd64 go build -ldflags="-s -w" -o tgpt-freebsd-amd64
GOOS=freebsd GOARCH=arm64 go build -ldflags="-s -w" -o tgpt-freebsd-arm64
GOOS=freebsd GOARCH=arm go build -ldflags="-s -w" -o tgpt-freebsd-arm
GOOS=freebsd GOARCH=386 go build -ldflags="-s -w" -o tgpt-freebsd-i386
echo "## Changelog:" >> ${{ github.workspace }}-CHANGELOG.txt
echo "<details><summary>SHA256 Hashes</summary><code>" >> ${{ github.workspace }}-CHANGELOG.txt
echo "SHA256 hashes of the built binaries:"
echo "SHA256 hashes of the built binaries:" >> ${{ github.workspace }}-CHANGELOG.txt
sha256sum tgpt-linux-amd64
sha256sum tgpt-linux-amd64 >> ${{ github.workspace }}-CHANGELOG.txt
sha256sum tgpt-linux-i386
sha256sum tgpt-linux-i386 >> ${{ github.workspace }}-CHANGELOG.txt
sha256sum tgpt-linux-arm64
sha256sum tgpt-linux-arm64 >> ${{ github.workspace }}-CHANGELOG.txt
sha256sum tgpt-amd64.exe
sha256sum tgpt-amd64.exe >> ${{ github.workspace }}-CHANGELOG.txt
sha256sum tgpt-i386.exe
sha256sum tgpt-i386.exe >> ${{ github.workspace }}-CHANGELOG.txt
sha256sum tgpt-mac-amd64
sha256sum tgpt-mac-amd64 >> ${{ github.workspace }}-CHANGELOG.txt
sha256sum tgpt-mac-arm64
sha256sum tgpt-mac-arm64 >> ${{ github.workspace }}-CHANGELOG.txt
echo "</code></details>" >> ${{ github.workspace }}-CHANGELOG.txt
- name: Upload Artifacts
id: upload-artifacts
uses: softprops/action-gh-release@v1
with:
files: |
tgpt-linux-amd64
tgpt-linux-i386
tgpt-linux-arm64
tgpt-linux-arm
tgpt-amd64.exe
tgpt-i386.exe
tgpt-arm.exe
tgpt-arm64.exe
tgpt-mac-amd64
tgpt-mac-arm64
tgpt-netbsd-amd64
tgpt-netbsd-arm64
tgpt-netbsd-arm
tgpt-netbsd-i386
tgpt-freebsd-amd64
tgpt-freebsd-arm64
tgpt-freebsd-arm
tgpt-freebsd-i386
tgpt-openbsd-amd64
tgpt-openbsd-arm64
tgpt-openbsd-arm
tgpt-openbsd-i386
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
tag_name: v
name: tgpt
body_path: ${{ github.workspace }}-CHANGELOG.txt
# - name: Install Snapcraft
# run: |
# sudo apt update
# sudo apt install snapd jq
# sudo snap install core
# sudo snap install snapcraft --classic
# - name: Build Snap package
# run: |
# snapcraft init
# echo "name: Terminal GPT" >> snap/snapcraft.yaml
# echo "version: $(jq ".version" < version.txt')" >> snap/snapcraft.yaml
# echo "summary: CLI tool for ChatGPT 3.5" >> snap/snapcraft.yaml
# echo "description: |" >> snap/snapcraft.yaml
# echo " gpt is a cross-platform command-line interface (CLI) tool that allows you to" >> snap/snapcraft.yaml
# echo " use ChatGPT 3.5 in your Terminal without requiring API keys." >> snap/snapcraft.yaml
# echo "confinement: strict" >> snap/snapcraft.yaml
# echo "parts:" >> snap/snapcraft.yaml
# echo " tgpt:" >> snap/snapcraft.yaml
# echo " plugin: go" >> snap/snapcraft.yaml
# echo " source: https://raw.githubusercontent.com/aandrew-me/tgpt/main/install" >> snap/snapcraft.yaml
# echo "apps:" >> snap/snapcraft.yaml
# echo " tgpt:" >> snap/snapcraft.yaml
# echo " command: tgpt" >> snap/snapcraft.yaml
# echo " plugs: [home, network, network-bind]" >> snap/snapcraft.yaml
# snapcraft
# - name: Publish to Snap Store
# env:
# SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
# run: |
# snapcraft push --release=edge *.snap