v0.2.2 #11
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: Publish | |
on: | |
release: | |
types: [published] | |
branches: | |
- main | |
- canary | |
- feat/autopublish | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Setup Repo | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Setup NPM authentication | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Install Dependencies | |
run: yarn install --immutable | |
- name: Determine branch from tag | |
run: | | |
BRANCH=$(git branch -r --contains $GITHUB_SHA | grep -Eo 'origin/\S+' | sed 's|origin/||' | head -n 1) || ${{ github.ref }} | |
echo "Branch is $BRANCH" | |
echo "BRANCH=$BRANCH" >> $GITHUB_ENV | |
- name: Checkout branch | |
run: git checkout $BRANCH | |
- name: Ensure version from tag | |
run: | | |
git fetch --tags | |
npx lerna version --yes --no-push --exact --force-publish | |
- name: Publish stable | |
run: yarn release-stable | |
if: github.ref == 'refs/heads/main' | |
- name: Publish canary | |
run: yarn release-canary | |
if: github.ref != 'refs/heads/main' |