Update build command #50
Workflow file for this run
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: Build and publish | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- master | |
- develop | |
- beta | |
- stable | |
- test-publish | |
jobs: | |
build: | |
if: github.event.pull_request.merged | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: oven-sh/setup-bun@v1 | |
- name: Install dependencies | |
run: | | |
yarn install | |
- name: Set version and branch | |
run: | | |
export BRANCH=${GITHUB_REF##*/} | |
export VERSION=$(npm run --silent version) | |
echo "Branch: $BRANCH" | |
echo "Base version: $VERSION" | |
export VERSION=$(bash ./helper-scripts/calculate_version.sh) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "BRANCH=$BRANCH" >> $GITHUB_ENV | |
echo "Version $VERSION" | |
- name: Set release | |
run: | | |
if [[ "$BRANCH" == "stable" ]]; then | |
export PRERELEASE=false | |
else | |
export PRERELEASE=true | |
fi | |
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV | |
- name: Yarn build | |
run: | | |
yarn prepack | |
- name: Publish on npm | |
run: | | |
if [[ "$BRANCH" == "stable" ]]; then | |
npm publish --access public | |
else | |
npm version --no-git-tag-version ${{ env.VERSION }} --allow-same-version | |
npm publish --access public --tag ${{ env.BRANCH }} | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Build CLI | |
run: | | |
bun build:exec | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_name: ${{ env.VERSION }} | |
draft: false | |
prerelease: ${{ env.PRERELEASE }} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ima |