forked from yanyiwu/nodejieba
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (59 loc) · 1.74 KB
/
Copy pathgithub_release.yml
File metadata and controls
63 lines (59 loc) · 1.74 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
name: GitHub Release
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build (e.g. v3.5.3)'
required: true
default: 'v3.5.3'
push:
tags:
- 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18.x, 20.x, 22.x, 24.x]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
submodules: recursive
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
- name: Package Binary
run: |
npm install -g @mapbox/node-pre-gyp
npx @mapbox/node-pre-gyp package
- name: Find packaged binary
id: find_binary
shell: bash
run: |
BINARY_PATH=$(find ./build/stage -name "*.tar.gz" | head -1)
echo "binary_path=$BINARY_PATH" >> $GITHUB_OUTPUT
# Extract the directory structure for organizing in release
BINARY_NAME=$(basename "$BINARY_PATH")
PARENT_DIR=$(basename $(dirname "$BINARY_PATH"))
echo "binary_name=$BINARY_NAME" >> $GITHUB_OUTPUT
echo "parent_dir=$PARENT_DIR" >> $GITHUB_OUTPUT
- name: Upload Binary
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ inputs.tag || github.ref_name }}
name: ${{ inputs.tag || github.ref_name }}
draft: false
prerelease: false
generate_release_notes: true
fail_on_unmatched_files: false
files: |
./build/stage/**/*.tar.gz