Skip to content

Commit

Permalink
fix: 优化 actions 19
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Mar 17, 2023
1 parent 2e2cc8d commit c62b53b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
42 changes: 27 additions & 15 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
permissions:
contents: write
pull-requests: write
packages: write

jobs:
release:
Expand All @@ -16,44 +17,55 @@ jobs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-env
- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
bump-minor-pre-major: true
test:
test-coverage:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.release_created
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-env
- run: npm ci
- run: npm run test
- run: npm run test-coverage
- uses: codacy/codacy-coverage-reporter-action@v1
with:
api-token: ${{ secrets.CODACY_API_TOKEN }}
coverage-reports: coverage/lcov.info
publish:
publish-npm:
runs-on: ubuntu-latest
needs: test
needs: test-coverage
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-env
- run: npm ci
- run: npm run build
- run: npm publish --registry=https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- run: echo "registry=https://registry.npmjs.org/" >> .npmrc
- run: echo "always-auth=true" >> .npmrc
- run: npm publish
- uses: jaywcjlove/github-action-package@main
id: pkg
- run: curl --silent -X PUT https://registry-direct.npmmirror.com/${{ steps.pkg.outputs.name }}/sync?sync_upstream=true
name: Sync the new version to npmmirror.com
- uses: actions/setup-node@v3
with:
registry-url: https://npm.pkg.github.com
- run: npm publish --registry=https://npm.pkg.github.com
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-github:
runs-on: ubuntu-latest
needs: test-coverage
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/node-env
- run: npm ci
- run: npm run build
- run: echo "//npm.pkg.github.com/:_authToken=${{ github.token }}" > .npmrc
- run: echo "registry=https://npm.pkg.github.com/" >> .npmrc
- run: echo "always-auth=true" >> .npmrc
- uses: jaywcjlove/github-action-package@main
width:
data: |
{
"name": "@${{ github.repository }}"
}
- run: npm publish
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"prepare": "husky install",
"lint": "eslint src/**/*.ts && tsc --project tsconfig.json --noEmit",
"test": "vitest run --coverage",
"test": "vitest run",
"test-coverage": "vitest run --coverage",
"build:types": "rm -rf dist-dts && tsc --project tsconfig.types.json",
"build:files": "rm -rf dist-cjs dist-mjs && rollup --config",
"build": "npm run build:types && npm run build:files"
Expand Down

0 comments on commit c62b53b

Please sign in to comment.