Skip to content

Fix version check

Fix version check #35

Workflow file for this run

name: Publish ui
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/ui
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Check version
id: check
run: |
PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
RESPONSE=$(curl --silent --head https://registry.npmjs.org/@data-story/ui/$PACKAGE_VERSION) || true
if [ $? -eq 0 ]; then
echo "Version $PACKAGE_VERSION already exists. Exiting the action script."
exit 0
fi
- name: remove overlying workspace
run: rm ../../yarn.lock && rm ../../package.json
- name: Install dependencies
run: npm install
- name: Build
run: npx tsc
- name: Build css
run: npx tailwindcss build -o ./dist/data-story.css
- name: Bundle
run: npx webpack
- name: Version
run: npm version patch -m "Upgrade to %s"
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_DATA_STORY }}