Release new version #46
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 new version' | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to release ( ex: v0.0.1 )' | |
required: true | |
env: | |
node-version: 14.x | |
jobs: | |
check-version: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
STACK_PKG_VERSION="v$(cat package.yaml | grep version | cut -d":" -f2 | xargs)" | |
JS_PKG_VERSION="v$(cat pkg/package.json | grep version | cut -d":" -f2 | cut -d"\"" -f2)" | |
TAG_NAME=${{ github.event.inputs.version }} | |
if [ "$TAG_NAME" = "$STACK_PKG_VERSION" -a "$TAG_NAME" = "$JS_PKG_VERSION" ]; | |
then | |
echo "Versions match" | |
else | |
echo "Versions in package.yaml and package.json don't match the tag" | |
exit 1 | |
fi | |
release: | |
needs: check-version | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 'Changelog: generate changelog' | |
id: changelog | |
uses: TriPSs/[email protected] | |
with: | |
presets: 'conventionalcommits' | |
github-token: ${{ secrets.github_token }} | |
skip-on-empty: false | |
output-file: false | |
tag-prefix: 'v' | |
skip-commit: true | |
skip-version-file: true | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
release_name: Release ${{ github.event.inputs.version }} | |
body: ${{ steps.changelog.outputs.clean_changelog }} | |
draft: false | |
prerelease: false | |
- name: Start release for osx | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: Build osx target for release | |
token: ${{ secrets.TOKEN_GITHUB }} | |
inputs: '{ "version": "${{ github.event.inputs.version }}" }' | |
- name: Start release for linux | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: Build linux target for release | |
token: ${{ secrets.TOKEN_GITHUB }} | |
inputs: '{ "version": "${{ github.event.inputs.version }}" }' | |
- name: Start release for linux alpine | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: Build linux alpine target for release | |
token: ${{ secrets.TOKEN_GITHUB }} | |
inputs: '{ "version": "${{ github.event.inputs.version }}" }' | |
- name: Start release for windows | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: Build windows target for release | |
token: ${{ secrets.TOKEN_GITHUB }} | |
inputs: '{ "version": "${{ github.event.inputs.version }}" }' | |
publish: | |
needs: release | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: ./pkg | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ env.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.node-version }} | |
- run: cp -R ../prelude ./ | |
# - run: npm install | |
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- run: npm publish --access public |