Skip to content

Commit

Permalink
build(actions): ✨ add release-beta action
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-Xu-0100 committed Mar 28, 2021
1 parent 8b024ed commit fbdb38b
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/release-beta.yml
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' }}

0 comments on commit fbdb38b

Please sign in to comment.