-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(actions): ✨ add release-beta action
- Loading branch information
1 parent
8b024ed
commit fbdb38b
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: 'release beta' | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Prepare beta version package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
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' | ||
run: | | ||
npm view ${env.packageName} version > version.txt | ||
npm view ${env.packageName}@beta version >> version.txt | ||
version=`sort -rV version.txt | sed -n '1p'` | ||
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' | ||
rm version.txt | ||
- name: Get version from package.json | ||
uses: actions/[email protected] | ||
id: version | ||
with: | ||
result-encoding: string | ||
script: | | ||
const version = require(`${process.env.GITHUB_WORKSPACE}/package.json`).version; | ||
core.setOutput('version', version); | ||
- name: Get Changelog Entry | ||
id: changelog_reader | ||
uses: mindsers/[email protected] | ||
with: | ||
version: ${{steps.version.outputs.version}} | ||
path: ./CHANGELOG.md | ||
|
||
- name: Create release | ||
id: create_release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{steps.version.outputs.version}} | ||
release_name: Release v${{steps.version.outputs.version}} | ||
body: ${{ steps.changelog_reader.outputs.changes }} | ||
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} | ||
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} |