Skip to content

Commit f31775a

Browse files
committed
fix(ci): ci env
1 parent 1ae09e4 commit f31775a

File tree

3 files changed

+43
-22
lines changed

3 files changed

+43
-22
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010

11-
strategy:
12-
matrix:
13-
node-version: ["18"]
14-
1511
steps:
1612
- uses: actions/checkout@v3
1713
with:
@@ -25,44 +21,43 @@ jobs:
2521
- name: Setup Node.js
2622
uses: actions/setup-node@v3
2723
with:
28-
node-version: ${{ matrix.node-version }}
24+
node-version: "18"
2925

3026
- name: Cache dependencies
31-
uses: actions/cache@v2
32-
id: yarn-cache
27+
uses: actions/cache@v3
3328
with:
3429
path: |
3530
**/node_modules
36-
key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
31+
key: ${{ runner.os }}-node-18-yarn-${{ hashFiles('**/yarn.lock') }}
3732
restore-keys: |
38-
${{ runner.os }}-node-${{ matrix.node-version }}-yarn-
33+
${{ runner.os }}-node-18-yarn-
3934
4035
- name: Install dependencies
4136
run: yarn install
4237

4338
- name: Type check
4439
run: yarn typecheck
45-
continue-on-error: false
4640

4741
- name: Check code quality
4842
run: |
49-
set -e
50-
trap 'echo "Error in $BASH_COMMAND at line $LINENO"' ERR
5143
yarn lint
5244
yarn format:check
5345
yarn run --if-present generate
5446
5547
- name: Security Audit
56-
run: yarn audit --level moderate
48+
run: yarn audit --level moderate || true
5749
continue-on-error: true
5850

51+
- name: Security Audit Summary
52+
if: success() || failure()
53+
run: yarn audit --summary
54+
5955
- name: Archive production artifacts
60-
if: always()
61-
uses: actions/upload-artifact@v2
56+
uses: actions/upload-artifact@v3
6257
with:
6358
name: build-artifacts
6459
path: ./build/
6560

6661
- name: Error handling
67-
if: ${{ failure() }}
62+
if: failure()
6863
run: echo "CI failed. Please check the logs."

.github/workflows/npm-publish.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,59 @@ jobs:
1212
- uses: actions/setup-node@v3
1313
with:
1414
node-version: 18
15+
- run: yarn
16+
- run: yarn generate
17+
- uses: actions/upload-artifact@v3
18+
with:
19+
name: built-package
20+
path: |
21+
./path-to-your-build-folder
22+
package.json
1523
1624
publish-npm:
1725
needs: build
1826
runs-on: ubuntu-latest
1927
steps:
2028
- uses: actions/checkout@v3
29+
- uses: actions/download-artifact@v3
30+
with:
31+
name: built-package
2132
- uses: actions/setup-node@v3
2233
with:
2334
node-version: 18
2435
registry-url: https://registry.npmjs.org/
2536
scope: "@smakss"
26-
- run: yarn && yarn generate
27-
- run: npm publish
37+
- run: |
38+
if grep -q "beta" package.json; then
39+
echo "Publishing Beta to npm"
40+
npm publish --tag beta
41+
else
42+
echo "Publishing Release to npm"
43+
npm publish
44+
fi
2845
env:
29-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
46+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
3047
3148
publish-gpr:
3249
needs: build
3350
runs-on: ubuntu-latest
3451
steps:
3552
- uses: actions/checkout@v3
53+
- uses: actions/download-artifact@v3
54+
with:
55+
name: built-package
3656
- uses: actions/setup-node@v3
3757
with:
3858
node-version: 18
3959
registry-url: https://npm.pkg.github.com/
4060
scope: "@smakss"
41-
- run: yarn && yarn generate
42-
- run: npm publish
61+
- run: |
62+
if grep -q "beta" package.json; then
63+
echo "Publishing Beta to GitHub Package Registry"
64+
npm publish --tag beta
65+
else
66+
echo "Publishing Release to GitHub Package Registry"
67+
npm publish
68+
fi
4369
env:
4470
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@
6868
"typecheck": "tsc -b ."
6969
},
7070
"type": "module",
71-
"version": "3.1.0-beta.0"
71+
"version": "3.1.0-beta.1"
7272
}

0 commit comments

Comments
 (0)