-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (91 loc) · 2.46 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
---
'on':
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
# https://github.com/softprops/action-gh-release/issues/236
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
shell: bash
- runs-on: macos-latest
shell: bash
- runs-on: windows-latest
shell: msys2
runs-on: ${{matrix.runs-on}}
defaults:
run:
shell: ${{matrix.shell}} {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
- name: Install dependencies
if: runner.os == 'Windows'
# https://github.com/xmake-io/xmake/discussions/5699
# xmake needs git
# xmake search cxx for MinGW
run: |
pacman -Sy --noconfirm mingw-w64-x86_64-pkg-config \
mingw-w64-x86_64-librime mingw-w64-x86_64-nodejs \
mingw-w64-x86_64-gcc mingw-w64-x86_64-xmake git
ln -s c++ /mingw64/bin/cxx
- name: Enable corepack
run: |
corepack enable
- uses: actions/setup-node@v4
# it uses cmd on windows, not msys2
if: runner.os != 'Windows'
with:
node-version: latest
registry-url: https://registry.npmjs.org
cache: 'yarn'
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo add-apt-repository ppa:xmake-io/xmake
sudo apt-get -y update
sudo apt-get -y install librime-dev librime1 xmake
- name: Install dependencies
if: runner.os == 'macOS'
run: |
brew install librime xmake
- name: Build
run: |
yarn install
yarn pack
env:
NODE_ENV: production
- uses: actions/upload-artifact@v4
with:
name: artifact-${{matrix.runs-on}}
path: |
prebuilds/*
publish:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
merge-multiple: true
path: prebuilds
- uses: softprops/action-gh-release@v2
with:
files: '*.tgz'
- name: Publish
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
NODE_ENV: production
run: |
npm publish