-
-
Notifications
You must be signed in to change notification settings - Fork 7
107 lines (90 loc) · 2.68 KB
/
ci.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
name: CI
on:
pull_request:
types:
- opened
- synchronize
paths-ignore:
- README.md
push:
branches:
- main
- "renovate/**"
paths-ignore:
- README.md
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
check-typos:
name: Check typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master
with:
files: .
wasm:
name: Build Wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: oxc-project/oxc
ref: main
- uses: Boshen/setup-rust@main
with:
save-cache: ${{ github.ref_name == 'main' }}
tools: wasm-pack,just
- run: just build-wasm
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: wasm
path: npm/oxc-wasm
build:
needs: wasm
name: Build Playground
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: ./node-version
cache: pnpm
- run: pnpm install --frozen-lockfile
# Download after to invalidate the version from pnpm cache
- uses: actions/download-artifact@v4
with:
merge-multiple: true
name: wasm
path: ../oxc/npm/oxc-wasm
- run: pnpm run build
- name: Install Netlify
run: pnpm install -g [email protected]
# https://www.raulmelo.me/en/blog/deploying-netlify-github-actions-guide
- name: Deploy to Netlify
id: netlify_deploy
run: |
prod_flag=""
if [ "${{ github.ref_name }}" = "main" ]; then prod_flag="--prod"; fi
netlify deploy \
--dir dist \
--site ${{ secrets.NETLIFY_SITE_ID }} \
--auth ${{ secrets.NETLIFY_API_TOKEN }} \
$prod_flag \
--json \
> deploy_output.json
- name: Generate URL Preview
id: url_preview
if: github.event_name == 'pull_request'
run: |
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' deploy_output.json)
echo "NETLIFY_PREVIEW_URL=$NETLIFY_PREVIEW_URL" >> $GITHUB_OUTPUT
- uses: peter-evans/create-or-update-comment@v4
if: github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.number }}
body: "Preview URL: ${{ steps.url_preview.outputs.NETLIFY_PREVIEW_URL }}"