ci: only publish @supabase/gotrue-js if version is not 0.0.0 (#828) #409
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: | |
- master | |
- next | |
- rc | |
workflow_dispatch: | |
jobs: | |
release: | |
name: Release / Node ${{ matrix.node }} | |
strategy: | |
matrix: | |
node: ['18'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node }} | |
- run: | | |
npm ci | |
npm run build | |
- name: Create a release for @supabase/auth-js | |
run: npx semantic-release -r 'https://github.com/supabase/gotrue-js.git' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish @supabase/gotrue-js | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
if [ "0.0.0" -neq $(jq -r '.version' package.json) ] | |
then | |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/.npmrc | |
for f in package.json package-lock.json | |
do | |
sed -i 's|\(["/]\)auth-js|\1gotrue-js|g' "$f" | |
done | |
npm publish --tag latest | |
fi | |