Skip to content

Commit

Permalink
build(actions): ✅ test publishing beta version to npmjs
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-Xu-0100 committed Mar 28, 2021
1 parent 80b77a6 commit b8a21e7
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,6 @@ jobs:
with:
fetch-depth: 0

- name: Setup nodejs
uses: actions/[email protected]
with:
node-version: 12

- uses: actions/[email protected]
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'
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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/[email protected]
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'
scope: '@${{ steps.version.outputs.owner }}'

- uses: actions/[email protected]
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 }}

0 comments on commit b8a21e7

Please sign in to comment.