-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (85 loc) · 2.8 KB
/
node.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
name: node
on:
# Runs on all pushes
push:
# # A push is made to a GitHub Pages-enabled branch
# page_build:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# When pushing new commits, cancel any running builds on that branch
concurrency:
group: node-${{ github.ref }}
cancel-in-progress: true
env:
PROJECT_NAME: 'esbuild-scripts'
PROJECT_VERSION: '0.0.21.${{ github.sha }}'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ENV: 'production'
BUILD_DIR: 'dist'
TSC_COMPILE_ON_ERROR: false
# fast refresh probably does nothing in prod...
FAST_REFRESH: true
jobs:
run:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [20, latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache-dependency-path: yarn.lock
- name: Environment
shell: bash
working-directory: ${{ github.workspace }}
run: |
cp .env.example .env
cp .env.example .env.local
cp .env.test .env.test.local
cp .env.development .env.development.local
cp .env.production .env.production.local
- name: Install
shell: bash
working-directory: ${{ github.workspace }}
run: yarn
- name: Test
shell: bash
env:
NODE_ENV: test
working-directory: ${{ github.workspace }}
run: yarn test
- name: Build
shell: bash
env:
NODE_ENV: production
working-directory: ${{ github.workspace }}
run: yarn build
- name: Start
shell: bash
env:
NODE_ENV: production
working-directory: ${{ github.workspace }}
run: yarn start build
- name: Pack
shell: bash
env:
NODE_ENV: production
working-directory: ${{ github.workspace }}
run: yarn pack --filename ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.os }}-node-${{ matrix.node-version }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.os }}-node-${{ matrix.node-version }}
path: '${{ github.workspace }}/${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.os }}-node-${{ matrix.node-version }}'
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.os }}-node-${{ matrix.node-version }}
path: '${{ github.workspace }}'
github-token: ${{ env.GITHUB_TOKEN }}