chore: allow manually trigering release (#223) #85
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
name: Release | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: {} | |
jobs: | |
release_bin: | |
name: Release Binaries | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@master | |
- name: Git Unshalow | |
run: git fetch --prune --unshallow | |
- name: Fetch Node Packages | |
run: | | |
yarn --verbose | |
- name: Get Previous Tag | |
id: previous_tag | |
uses: 'WyriHaximus/github-action-get-previous-tag@v1' | |
- name: Get Current Version | |
id: extract_version | |
uses: Saionaro/[email protected] | |
- name: Validate Semver | |
id: validate_semver | |
run: | | |
valid_latest_tag=$(node ./node_modules/semver/bin/semver.js ${{ steps.previous_tag.outputs.tag }}) | |
valid_current_version=$(node ./node_modules/semver/bin/semver.js ${{ steps.extract_version.outputs.version }}) | |
change_log=$(node -e "require('./scripts/utils/changelog.js').getChangeLog().then(cl => console.log(cl))") | |
# if not change log is truncated at first line | |
change_log="${change_log//'%'/'%25'}" | |
change_log="${change_log//$'\n'/'%0A'}" | |
change_log="${change_log//$'\r'/'%0D'}" | |
echo $valid_latest_tag | |
echo $valid_current_version | |
echo $change_log | |
echo "::set-output name=valid_latest_tag::$valid_latest_tag" | |
echo "::set-output name=valid_current_version::$valid_current_version" | |
echo "::set-output name=change_log::$change_log" | |
- name: 'Build and Package' | |
if: ${{ steps.validate_semver.outputs.valid_latest_tag != steps.validate_semver.outputs.valid_current_version }} | |
run: | | |
yarn build | |
yarn package | |
- name: 'Release' | |
if: ${{ steps.validate_semver.outputs.valid_latest_tag != steps.validate_semver.outputs.valid_current_version }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./dist/nlu-v* | |
prerelease: false | |
draft: false | |
body: ${{ steps.validate_semver.outputs.change_log }} | |
name: v${{ steps.validate_semver.outputs.valid_current_version }} | |
tag_name: v${{ steps.validate_semver.outputs.valid_current_version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |