-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (71 loc) · 2.11 KB
/
ci-build.yaml
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
# Runs on push to main branch and PRs to main branch
name: CI Build
on:
push:
branches: ['main']
tags-ignore: ['v*.*.*']
paths: ['src/**', 'shaders/**']
pull_request:
branches: ['main']
permissions:
contents: write
jobs:
lint-check:
# I hate this but it's the only way to skip the build job when releasing
if: ${{ !contains(github.event.head_commit.message, 'Releasing new version') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: x.20
cache: 'npm'
- name: Run lint and check
run: |
npm ci
npm run lint
npm run check
build:
runs-on: ubuntu-latest
needs: lint-check
# Only run on main branch
## sif: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: x.20
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: NPM install & version
env:
NODE_ENV: production
run: |
npm ci --include=dev
npm version prerelease --preid=${GITHUB_SHA:0:7} --no-git-tag-version
git status
- name: Build all bundles
env:
NODE_ENV: production
run: |
npm run build-single
npm run build
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add dist-single
git commit -m "Automated build of dist-bundle $(date -u)"
- name: Push dist-bundle back to GitHub
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Publish prerelease to npmjs registry
run: |
npm publish --tag=pre
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}