-
Notifications
You must be signed in to change notification settings - Fork 10
94 lines (79 loc) · 2.56 KB
/
build.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
name: Build
on:
release:
types:
- created
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
target:
- runs-on: windows-latest
platform: windows
- runs-on: ubuntu-latest
platform: linux
- runs-on: ubuntu-latest
platform: linux
emulate: arm64
- runs-on: macos-latest
platform: darwin
runs-on: ${{ matrix.target.runs-on }}
steps:
- name: Set up variables
id: vars
shell: bash
run: |
echo "NODE_VERSION=${{ matrix.target.node || '20' }}" >> $GITHUB_OUTPUT
echo "ARCH=${{ matrix.target.emulate || 'amd64' }}" >> $GITHUB_OUTPUT
- name: Install nix (for arm64)
if: ${{ matrix.target.emulate }}
uses: cachix/install-nix-action@v20
- name: Set up qemu and binfmt (for arm64)
if: ${{ matrix.target.emulate }}
uses: docker/setup-qemu-action@v2
with:
platforms: ${{ matrix.target.emulate }}
- name: Check out
uses: actions/checkout@v4
with:
ref: develop
- name: Set up Node
if: ${{ !matrix.target.emulate }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.vars.outputs.NODE_VERSION }}
- name: Set up Node (for arm64)
if: ${{ matrix.target.emulate == 'arm64' }}
run: |
nix profile install github:NixOS/nixpkgs/04719f0326c5f8084f1fc7d1ca3fb15f8f09bb5e#nodejs_${{ steps.vars.outputs.NODE_VERSION }} --option system aarch64-linux
- name: Install zip (for windows)
if: ${{ matrix.target.platform == 'windows' }}
run: choco install zip
- name: Prepare
run: bash .github/workflows/prepare.sh
- name: Install dependencies
run: |
yarn --no-immutable
- name: Pack file
run: bash .github/workflows/pack.sh
- name: Upload asset
shell: bash
run: >
bash .github/workflows/upload.sh
'${{ matrix.target.platform }}-${{ steps.vars.outputs.ARCH }}-node${{ steps.vars.outputs.NODE_VERSION }}'
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
docker:
runs-on: ubuntu-latest
needs: build
steps:
- name: Check out
uses: actions/checkout@v4
- name: Trigger docker build
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
if: ${{ env.DOCKER_USERNAME != null }}
run: gh workflow run Docker