-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (63 loc) · 2.23 KB
/
main.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
name: Lint, Test, and Publish
on:
push:
pull_request:
jobs:
main:
permissions:
contents: write # Let the bot push to main
issues: write
pull-requests: write # Let the bot comment on PR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # For haetae
- name: Checkout PR into branch
if: ${{ github.event_name == 'pull_request' }}
# On GitHub Actions, PR and tag are not to be checked out into a branch, but "detached HEAD".
# Only push is checked out into a branch.
# This check out the PR into a branch.
run: |
git checkout ${GITHUB_HEAD_REF#refs/heads/} || git checkout -b ${GITHUB_HEAD_REF#refs/heads/} && git pull
- name: Set up pnpm
uses: pnpm/action-setup@v2
with:
run_install: false # For cache
# pnpm should be installed before the setup-node action. REF: https://github.com/actions/setup-node/issues/530
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm eslint .
- name: Lint markdown
run: pnpm markdownlint .
- name: Lint glossary
run: pnpm lint:csv
- name: Lint config
run: pnpm lint:config
- name: Test
run: pnpm test
- name: Cache haetae
uses: actions/cache@v3
with:
path: .haetae
key: main-haetae-${{ github.ref }}-${{ github.sha }}
restore-keys: |
main-haetae-${{ github.ref }}-
main-haetae-
- name: haetae publish
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
pnpm haetae publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JJANGGA0214_DEVTO_API_KEY: ${{ secrets.JJANGGA0214_DEVTO_API_KEY }}
PINETREE2_DEVTO_API_KEY: ${{ secrets.PINETREE2_DEVTO_API_KEY }}