Skip to content

Commit

Permalink
fix: prevent error during publish
Browse files Browse the repository at this point in the history
  • Loading branch information
ryshu committed Mar 16, 2023
1 parent d4adb52 commit e8a8a92
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 34 deletions.
39 changes: 5 additions & 34 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: Node.js CI

on:
push:
branches: [master]
pull_request:

jobs:
test:
if: github.ref != 'refs/heads/master'
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -36,13 +35,8 @@ jobs:
run: npm test
env:
CI: true
- uses: actions/upload-artifact@v2
with:
name: coverage
path: .nyc_output

coverage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -58,32 +52,9 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm ci
- uses: actions/download-artifact@v2
with:
name: coverage
path: .nyc_output
- name: test
run: npm test
env:
CI: true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

release:
if: github.ref == 'refs/heads/master'
needs: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18.15.0'
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm ci
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Semver to tag new version and publish package

on:
push:
branches: [master, alpha, beta]

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18.15.0'
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm ci
- name: test
run: npm test
env:
CI: true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

release:
needs: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18.15.0'
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm ci
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit e8a8a92

Please sign in to comment.