Skip to content

fix: android and ios binaries to be downloaded using version from pac… #1

fix: android and ios binaries to be downloaded using version from pac…

fix: android and ios binaries to be downloaded using version from pac… #1

Workflow file for this run

name: Build and Publish
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
outputs:
should_publish: ${{ steps.version_check.outputs.should_publish }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: Typecheck
run: yarn typecheck
- name: Lint
run: yarn lint
- name: Build
run: yarn prepare
- name: Check version
id: version_check
run: |
PACKAGE_NAME=$(node -p "require('./package.json').name")
LOCAL_VERSION=$(node -p "require('./package.json').version")
NPM_VERSION=$(npm view "$PACKAGE_NAME" version 2>/dev/null || echo "0.0.0")
echo "Local version: $LOCAL_VERSION"
echo "npm version: $NPM_VERSION"
if [ "$LOCAL_VERSION" != "$NPM_VERSION" ]; then
echo "Version changed, will publish"
echo "should_publish=true" >> $GITHUB_OUTPUT
else
echo "Version unchanged, skipping publish"
echo "should_publish=false" >> $GITHUB_OUTPUT
fi
publish:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.build.outputs.should_publish == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn prepare
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}