Skip to content

eastern-arabic/v0.0.1-next.3 #4

eastern-arabic/v0.0.1-next.3

eastern-arabic/v0.0.1-next.3 #4

Workflow file for this run

name: Publish Next
on:
release:
types: [ prereleased ]
env:
TAG_NAME: ${{ github.event.release.tag_name }}
PACKAGE_NAME: "" # to be filled later
PACKAGE_VERSION: "" # to be filled later after checkout
jobs:
publish:
name: Publish next to npm
runs-on: ubuntu-latest
steps:
- name: fill package name
run: |
if [[ $TAG_NAME =~ ^eastern-arabic\/v.* ]]; then
PACKAGE_NAME="eastern-arabic"
else
echo "❌ tag name: $TAG_NAME doesn't point to any publishable package"
exit 1
fi
echo "📦 Package name: @numerals/$PACKAGE_NAME"
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: fill package version
run: |
PACKAGE_VERSION=$(jq -r '.version' packages/$PACKAGE_NAME/package.json)
echo "🔢 Package version: $PACKAGE_VERSION"
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: validate tag name
run: |
if [[ ! $TAG_NAME =~ ^$PACKAGE_NAME\/v([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-next\.([0-9]|[1-9][0-9]*)$ ]]; then
echo "❌ Invalid tag name: $TAG_NAME not suitable for @next tag"
exit 1
else
echo "✅ Valid tag name: $TAG_NAME"
fi
- name: validate version in package.json
run: |
if [[ ! $PACKAGE_VERSION =~ ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-next\.([0-9]|[1-9][0-9]*)$ ]]; then
echo "❌ Invalid version name: $PACKAGE_VERSION not suitable for @next publish"
exit 1
else
echo "✅ Valid @next version: $PACKAGE_VERSION"
fi
- name: check if version in package.json is matching tag name
run: |
if [[ "$PACKAGE_NAME/v$PACKAGE_VERSION" != $TAG_NAME ]]; then
echo "❌ Version in package.json of $PACKAGE_NAME: $PACKAGE_VERSION is not matching with tag name: $TAG_NAME"
exit 1
else
echo "✅ Version: $PACKAGE_VERSION in package.json of $PACKAGE_NAME is matching with tag name: $TAG_NAME"
fi
- uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
always-auth: true
cache: yarn
- run: yarn workspaces foreach --all install --immutable
- run: yarn lint
- run: yarn build
- run: yarn test
- name: publish @numerals/eastern-arabic @next to npm
if: ${{ env.PACKAGE_NAME == 'eastern-arabic' }}
run: yarn workspace @numerals/eastern-arabic npm publish --access public --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.EASTERN_ARABIC_PUBLISH_AUTH_TOKEN }}