From b8a21e7147d963c954fc20af788c1bd1b17caed9 Mon Sep 17 00:00:00 2001 From: yi_Xu Date: Sun, 28 Mar 2021 21:06:42 +0800 Subject: [PATCH] =?UTF-8?q?build(actions):=20=E2=9C=85=20test=20publishing?= =?UTF-8?q?=20beta=20version=20to=20npmjs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-beta.yml | 42 ++++++++++++++++++------------ 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release-beta.yml b/.github/workflows/release-beta.yml index 6d0987e..ea7bcd4 100644 --- a/.github/workflows/release-beta.yml +++ b/.github/workflows/release-beta.yml @@ -13,21 +13,6 @@ jobs: with: fetch-depth: 0 - - name: Setup nodejs - uses: actions/setup-node@v2.1.5 - with: - node-version: 12 - - - uses: actions/cache@v2.1.4 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - name: Setup package - run: npm install - - name: Bump beta version env: packageName: '@yi-xu-0100/conventional-commit-types-i18n' @@ -38,7 +23,7 @@ jobs: npx standard-version --release-as ${version} --skip.changelog --skip.commit --skip.tag npx standard-version --prerelease beta --skip.commit --skip.tag sed 's/^### \[/## [/' -i CHANGELOG.md - npx --no-install prettier --write 'CHANGELOG.md' --prose-wrap never --ignore-path './gitignore' + npx prettier --write 'CHANGELOG.md' --prose-wrap never --ignore-path './gitignore' rm version.txt - name: Get version from package.json @@ -48,6 +33,7 @@ jobs: result-encoding: string script: | const version = require(`${process.env.GITHUB_WORKSPACE}/package.json`).version; + core.setOutput('owner', context.repo.owner); core.setOutput('version', version); - name: Get Changelog Entry @@ -68,3 +54,27 @@ jobs: body: ${{ steps.changelog_reader.outputs.changes }} prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} + + - name: Setup node + uses: actions/setup-node@v2.1.5 + with: + node-version: 12 + registry-url: 'https://registry.npmjs.org' + scope: '@${{ steps.version.outputs.owner }}' + + - uses: actions/cache@v2.1.4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Setup package + run: | + npm install + npm run build + + - name: Publish beta package to npmjs + run: npm publish --tag beta --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}