-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (58 loc) · 1.97 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
name: Build and test and release
on:
push:
branches: [main, staging]
pull_request:
branches: [main, staging]
env:
NEXT_SECRET_GRIST_DOMAIN: ${{ secrets.NEXT_SECRET_GRIST_DOMAIN }}
NEXT_SECRET_GRIST_DOC_ID: ${{ secrets.NEXT_SECRET_GRIST_DOC_ID }}
NEXT_SECRET_GRIST_RECORDS_TABLE: ${{ secrets.NEXT_SECRET_GRIST_RECORDS_TABLE }}
NEXT_SECRET_GRIST_LABELS_TABLE: ${{ secrets.NEXT_SECRET_GRIST_LABELS_TABLE }}
NEXT_SECRET_GRIST_TEXTS_TABLE: ${{ secrets.NEXT_SECRET_GRIST_TEXTS_TABLE }}
NEXT_SECRET_GRIST_API_KEY: ${{ secrets.NEXT_SECRET_GRIST_API_KEY }}
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout@v3
- name: Set nvmrc version as .env variable
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version: "${{ env.NODE_VERSION }}"
- run: npm ci
- run: npm run build --if-present
- run: npm run lint
- run: npm run type-check
- run: npm run test:ci
env:
CI: true
release:
name: semantic-release
needs: [build]
runs-on: ubuntu-latest
outputs:
new-release-published: ${{ steps.semantic-release.outputs.new_release_published }}
new-release-version: ${{ steps.semantic-release.outputs.new_release_version }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
- run: npm ci
- id: semantic-release
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 18
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}