|
1 |
| -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created |
2 |
| -# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages |
3 |
| - |
4 | 1 | name: Main
|
5 | 2 |
|
6 | 3 | on:
|
7 | 4 | push:
|
8 | 5 | paths-ignore:
|
9 |
| - - "lib/**" # TODO: remove lib folder |
10 |
| - - "**/*.md" |
11 |
| - - "**/.*" |
| 6 | + - '**/*.md' |
| 7 | + - '**/*.code-*' |
| 8 | + - '.vscode/**' |
| 9 | + - '.devcontainer.json' |
| 10 | + - '.gitignore' |
12 | 11 | workflow_dispatch:
|
13 | 12 |
|
14 | 13 | jobs:
|
15 | 14 | test:
|
16 |
| - runs-on: ubuntu-latest |
17 |
| - strategy: |
18 |
| - matrix: |
19 |
| - node: [19.7] |
20 |
| - steps: |
21 |
| - - uses: actions/checkout@v3 |
22 |
| - |
23 |
| - - name: Set up Node ${{ matrix.node }} |
24 |
| - uses: actions/setup-node@v3 |
25 |
| - with: |
26 |
| - node-version: ${{ matrix.node }} |
27 |
| - |
28 |
| - # TODO: cache node packages |
29 |
| - - name: Install Node Packages |
30 |
| - run: npm install |
31 |
| - |
32 |
| - - name: Check Code Format |
33 |
| - run: npm run lint |
34 |
| - |
35 |
| - # TODO: https://www.pluralsight.com/guides/how-to-test-react-components-in-typescript |
36 |
| - # - name: Test Code |
37 |
| - # run: npm run test -- --watchAll=false |
38 |
| - |
39 |
| - # TODO: remove this job |
40 |
| - build: |
41 |
| - needs: [test] |
42 |
| - runs-on: ubuntu-latest |
43 |
| - steps: |
44 |
| - - uses: actions/checkout@v3 |
45 |
| - with: |
46 |
| - token: ${{ secrets.CFL_BOT_GITHUB_TOKEN }} |
47 |
| - |
48 |
| - - uses: actions/setup-node@v3 |
49 |
| - with: |
50 |
| - node-version: 19.7 |
51 |
| - |
52 |
| - - name: Setup Git |
53 |
| - run: | |
54 |
| - git config --local user.name cfl-bot |
55 |
| - git config --local user.email [email protected] |
56 |
| -
|
57 |
| - # TODO: cache node packages |
58 |
| - - name: Install Node Packages |
59 |
| - run: npm install --only=dev |
60 |
| - |
61 |
| - - name: Build Package |
62 |
| - run: npm run build |
63 |
| - |
64 |
| - - name: Push Build Files |
65 |
| - run: | |
66 |
| - git add lib/* |
67 |
| - if ! git diff --staged --quiet; then |
68 |
| - git commit -m "push build files" |
69 |
| - git push |
70 |
| - fi |
| 15 | + uses: ocadotechnology/codeforlife-workspace/.github/workflows/test-javascript-code.yaml@main |
| 16 | + secrets: inherit |
| 17 | + with: |
| 18 | + # Cannot be set with an env var. Value must match in the release job. |
| 19 | + node-version: 18 |
71 | 20 |
|
72 | 21 | release:
|
73 |
| - needs: [build] |
74 | 22 | concurrency: release
|
75 | 23 | runs-on: ubuntu-latest
|
| 24 | + needs: [test] |
76 | 25 | if: github.ref_name == 'main'
|
| 26 | + env: |
| 27 | + # Value must match in the test job. |
| 28 | + NODE_VERSION: 18 |
77 | 29 | steps:
|
78 |
| - - uses: actions/checkout@v3 |
| 30 | + - uses: actions/checkout@v4 |
79 | 31 | with:
|
80 | 32 | token: ${{ secrets.CFL_BOT_GITHUB_TOKEN }}
|
81 | 33 | fetch-depth: 0
|
82 | 34 |
|
83 |
| - - name: Pull Build Files |
84 |
| - run: git pull |
85 |
| - |
86 |
| - - uses: actions/setup-node@v3 |
| 35 | + - name: 🌐 Set up Node ${{ env.NODE_VERSION }} |
| 36 | + uses: actions/setup-node@v4 |
87 | 37 | with:
|
88 |
| - node-version: 19.7 |
| 38 | + node-version: ${{ env.NODE_VERSION }} |
89 | 39 |
|
90 |
| - # TODO: group release dependencies |
91 |
| - - name: Install Node Packages |
92 |
| - run: npm install --only=dev |
| 40 | + - name: 🛠 Install Dependencies |
| 41 | + run: | |
| 42 | + npm install --global npm |
| 43 | + npm install --global \ |
| 44 | + semantic-release@^20.1.1 \ |
| 45 | + @semantic-release/git@^10.0.1 \ |
| 46 | + @semantic-release/changelog@^6.0.2 |
93 | 47 |
|
94 |
| - - name: Publish Semantic Release |
| 48 | + - name: 🚀 Publish Semantic Release |
95 | 49 | env:
|
96 | 50 | GH_TOKEN: ${{ secrets.CFL_BOT_GITHUB_TOKEN }}
|
97 | 51 | GIT_AUTHOR_NAME: cfl-bot
|
|
0 commit comments