2
0
Michael Yang 1 жил өмнө
parent
commit
4cd9986dbb

+ 23 - 0
.github/workflows/publish.yaml

@@ -0,0 +1,23 @@
+name: publish
+
+on:
+  release:
+    types:
+      - created
+
+jobs:
+  publish:
+    runs-on: ubuntu-latest
+    environment: release
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions/setup-node@v4
+        with:
+          node-version: latest
+          cache: npm
+      - run: npm ci
+      - run: |
+          npm version ${GITHUB_REF_NAME#v}
+          npm publish
+        with:
+          NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

+ 25 - 0
.github/workflows/test.yaml

@@ -0,0 +1,25 @@
+name: test
+
+on:
+  pull_request:
+
+jobs:
+  test:
+    strategy:
+      matrix:
+        node-version: ['16', '18', '20']
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions/setup-node@v4
+        with:
+          node-version: ${{ matrix.node-version }}
+          cache: npm
+      - run: npm ci
+      - run: npm run lint
+      - run: npm test -- --coverage --coverageDirectory=coverage/results-${{ matrix.node-version }}
+      - uses: actions/upload-artifact@v3
+        with:
+          name: jest-results-${{ matrix.node-version }}
+          path: coverage/results-${{ matrix.node-version }}/*.xml
+        if: ${{ always() }}