forked from Abdenasser/neohtop-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (158 loc) · 4.9 KB
/
Copy pathrelease.yml
File metadata and controls
185 lines (158 loc) · 4.9 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
packages: write
env:
GO_VERSION: "1.25.0"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run tests
working-directory: cli
env:
CGO_ENABLED: "0"
run: go test -count=1 ./...
build-linux:
needs: [test]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goarch: amd64
suffix: linux-amd64
- goarch: arm64
suffix: linux-arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
working-directory: cli
env:
GOOS: linux
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o ../neohtop-cli-${{ matrix.suffix }} .
- name: Compress binary
run: |
tar czf neohtop-cli-${{ matrix.suffix }}.tar.gz neohtop-cli-${{ matrix.suffix }}
- uses: actions/upload-artifact@v4
with:
name: neohtop-cli-${{ matrix.suffix }}
path: neohtop-cli-${{ matrix.suffix }}.tar.gz
build-macos:
needs: [test]
runs-on: macos-latest
strategy:
matrix:
include:
- goarch: arm64
suffix: macos-arm64
- goarch: amd64
suffix: macos-amd64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
working-directory: cli
env:
GOOS: darwin
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "1"
run: go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o ../neohtop-cli-${{ matrix.suffix }} .
- name: Compress binary
run: |
tar czf neohtop-cli-${{ matrix.suffix }}.tar.gz neohtop-cli-${{ matrix.suffix }}
- uses: actions/upload-artifact@v4
with:
name: neohtop-cli-${{ matrix.suffix }}
path: neohtop-cli-${{ matrix.suffix }}.tar.gz
build-windows:
needs: [test]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
working-directory: cli
env:
GOOS: windows
GOARCH: amd64
CGO_ENABLED: "0"
run: go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o ../neohtop-cli-windows-amd64.exe .
- name: Compress binary
shell: bash
run: |
7z a neohtop-cli-windows-amd64.zip neohtop-cli-windows-amd64.exe
- uses: actions/upload-artifact@v4
with:
name: neohtop-cli-windows-amd64
path: neohtop-cli-windows-amd64.zip
release:
needs: [build-linux, build-macos, build-windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum *.tar.gz *.zip > checksums.txt
cat checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/neohtop-cli-linux-amd64.tar.gz
artifacts/neohtop-cli-linux-arm64.tar.gz
artifacts/neohtop-cli-macos-arm64.tar.gz
artifacts/neohtop-cli-macos-amd64.tar.gz
artifacts/neohtop-cli-windows-amd64.zip
artifacts/checksums.txt
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Publish to npm
working-directory: npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Sync version from git tag
VERSION="${GITHUB_REF_NAME#v}"
npm version "$VERSION" --no-git-tag-version --allow-same-version
mkdir -p bin
# The real launcher (bin/neohtop-cli.js) is already in the repo.
# The postinstall script (install.js) downloads the actual binary into bin/.
npm publish --access public
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://npm.pkg.github.com"
scope: "@abdenasser"
- name: Publish to GitHub Packages
working-directory: npm
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# GitHub Packages requires scoped package name
npm pkg set name="@abdenasser/neohtop-cli"
npm publish --access public