chore: version packages #137
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: publish-beta | |
on: | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '**' | |
paths-ignore: | |
- '**.md' | |
workflow_dispatch: | |
jobs: | |
pre-run: | |
uses: ./.github/workflows/pre-run.yml | |
secrets: inherit | |
publish-beta: | |
runs-on: ubuntu-latest | |
needs: pre-run | |
if: "needs.pre-run.outputs.is-not-fork == 'true' && !contains(github.event.head_commit.message, 'chore: version packages')" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# pulls all tags (needed for lerna to correctly version) | |
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
- run: npm install -g npm@latest | |
- run: npm ci | |
- run: git config --local user.email '[email protected]' | |
- run: git config --local user.name 'GitHub Action' | |
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Version & Publish | |
run: | | |
LATEST=$(git describe --tags --abbrev=0) | |
npx lerna version $LATEST --force-publish --no-changelog --no-push --no-git-tag-version --yes | |
git commit -a -m 'DONT PUSH: fast-forward to latest npm release' --allow-empty --no-verify | |
npx lerna version --force-publish --no-changelog --conventional-commits --conventional-prerelease --preid beta --no-push --no-git-tag-version --yes | |
git commit -a -m 'DONT PUSH: version beta release' --allow-empty --no-verify | |
RELEASE=$(cat lerna.json | jq -r '.version') | |
npx lerna publish from-package --no-verify-access --pre-dist-tag beta --yes | |
git reset HEAD~2 --hard | |
git tag v$RELEASE | |
git push origin v$RELEASE |