-
Notifications
You must be signed in to change notification settings - Fork 22
95 lines (77 loc) · 2.31 KB
/
main.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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Main
on:
push:
paths-ignore:
- "README.md"
- "CHANGELOG.md"
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [19.7]
steps:
- uses: actions/checkout@v3
- name: Set up Node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
# TODO: cache node packages
- name: Install Node Packages
run: npm install
- name: Check Code Format
run: npm run lint
# // TODO: https://www.pluralsight.com/guides/how-to-test-react-components-in-typescript
# - name: Test Code
# run: npm run test -- --watchAll=false
build:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: 19.7
- name: Setup Git
run: |
git config --local user.name cfl-bot
git config --local user.email [email protected]
# TODO: cache node packages
- name: Install Node Packages
run: npm install --only=dev
- name: Build Package
run: npm run build
- name: Push Build Files
run: |
git add lib/*
if ! git diff --staged --quiet; then
git commit -m "push build files [skip ci]"
git push
fi
release:
needs: [build]
concurrency: release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
- name: Pull Build Files
run: git pull
- uses: actions/setup-node@v3
with:
node-version: 19.7
# TODO: group release dependencies
- name: Install Node Packages
run: npm install --only=dev
- name: Publish Semantic Release
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: npx semantic-release