ci: fix a few things, using lerna! #13
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: | |
- main | |
- stable | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
registry-url: 'https://registry.npmjs.org/' | |
always-auth: true | |
cache: pnpm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Build Project | |
run: pnpm lerna run build | |
- name: Publish stable release | |
if: ${{ github.ref_name }} == 'stable' | |
run: | | |
pnpm lerna version --conventional-commits --conventional-graduate --amend --create-release github --yes | |
pnpm lerna publish from-package --yes | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
- name: Publish devlopement release | |
if: ${{ github.ref_name }} != 'stable' | |
run: | | |
pnpm lerna version --conventional-commits --conventional-prerelease --amend --preid dev --yes | |
pnpm lerna publish from-package --yes | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
- name: Set up git user, commit and push! | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "chore: publish packages [skip ci]" || echo "No changes to commit" | |
git push | |