-
Notifications
You must be signed in to change notification settings - Fork 1.6k
160 lines (141 loc) · 5.92 KB
/
release-v2.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Release latest v2 version
on:
workflow_dispatch:
jobs:
run_tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/setup-node@v3
with:
node-version: 21
- run: npm install
- run: npm run test
build_binaries:
name: Build Binaries
needs: [run_tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# setup global dependencies
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- run: npm install -g pkg
# build server project
- run: |
npm install
npm run bundle
# build client project
- run: |
cd faucet-client
npm install
node ./build-client.js
# publish npm packages
- run: |
npm set "//registry.npmjs.org/:_authToken=$NPM_TOKEN"
npm publish --access public || true
cd faucet-client
npm publish --access public || true
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# package bundled release
- name: Package bundled release
run: |
mv res/run-faucet.* ./
chmod +x ./run-faucet.sh
tar cfz powfaucet-server-all.tar.gz bundle static faucet-config.example.yaml run-faucet.sh
zip -r powfaucet-server-all.zip bundle static faucet-config.example.yaml run-faucet.bat
# package static folder
- name: Package static folder
run: |
tar cfz powfaucet-static.tar.gz static
zip -r powfaucet-static.zip static
# build binaries
- run: pkg --compress Brotli --options no-warnings .
# collect metadata
- name: Get project versions
run: |
echo "server_version=$(cat package.json | jq ".version" | tr -d '"\r\n')" >> $GITHUB_OUTPUT
echo "client_version=$(cat faucet-client/package.json | jq ".version" | tr -d '"\r\n')" >> $GITHUB_OUTPUT
id: version
# create draft release
- name: Create latest release
uses: actions/create-release@v1
id: create_release
with:
draft: true
prerelease: false
release_name: "v${{ steps.version.outputs.server_version }}"
tag_name: "v${{ steps.version.outputs.server_version }}"
body: |
### Major Changes
...
### Release Artifacts
| Release File | Description |
| ------------- | ------------- |
| powfaucet-server-all [.tar.gz](https://github.com/pk910/PoWFaucet/releases/download/v${{ steps.version.outputs.server_version }}/powfaucet-server-all.tar.gz) / [.zip](https://github.com/pk910/PoWFaucet/releases/download/v${{ steps.version.outputs.server_version }}/powfaucet-server-all.zip) | PoWFaucet server for execution with local nodejs (recommended) |
| [powfaucet-server-win.exe](https://github.com/pk910/PoWFaucet/releases/download/v${{ steps.version.outputs.server_version }}/powfaucet-server-win.exe) | PoWFaucet all-in-one executable for windows (NodeJS 18, 64bit) |
| [powfaucet-server-linux](https://github.com/pk910/PoWFaucet/releases/download/v${{ steps.version.outputs.server_version }}/powfaucet-server-linux) | PoWFaucet all-in-one executable for linux (NodeJS 18, 64bit) |
| powfaucet-static [.tar.gz](https://github.com/pk910/PoWFaucet/releases/download/v${{ steps.version.outputs.server_version }}/powfaucet-static.tar.gz) / [.zip](https://github.com/pk910/PoWFaucet/releases/download/v${{ steps.version.outputs.server_version }}/powfaucet-static.zip) | PoWFaucet static folder (optional, see [Operator Wiki](https://github.com/pk910/PoWFaucet/wiki/Operator-Wiki)) |
env:
GITHUB_TOKEN: ${{ github.token }}
# upload release artifacts
- name: "Upload artifact: powfaucet-server-linux"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/server-linux
asset_name: powfaucet-server-linux
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Upload artifact: powfaucet-server-win.exe"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/server-win.exe
asset_name: powfaucet-server-win.exe
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Upload artifact: powfaucet-server-all.tar.gz"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./powfaucet-server-all.tar.gz
asset_name: powfaucet-server-all.tar.gz
asset_content_type: application/gzip
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Upload artifact: powfaucet-server-all.zip"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./powfaucet-server-all.zip
asset_name: powfaucet-server-all.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Upload artifact: powfaucet-static.tar.gz"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./powfaucet-static.tar.gz
asset_name: powfaucet-static.tar.gz
asset_content_type: application/gzip
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Upload artifact: powfaucet-static.zip"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./powfaucet-static.zip
asset_name: powfaucet-static.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ github.token }}