Skip to content

Merge pull request #26 from dpMerchant/feat/add-docs #44

Merge pull request #26 from dpMerchant/feat/add-docs

Merge pull request #26 from dpMerchant/feat/add-docs #44

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 "Version: $PACKAGE_VERSION"
HTTP_STATUS=$(curl --silent --head --write-out "%{http_code}" --output /dev/null https://registry.npmjs.org/@data-story/ui/$PACKAGE_VERSION)
if [ $HTTP_STATUS -eq 200 ]; then
echo "Version $PACKAGE_VERSION already exists. Exiting the action script."
echo "VERSION_EXISTS=true" >> $GITHUB_ENV
else
echo "Version does not exist."
echo "VERSION_EXISTS=false" >> $GITHUB_ENV
fi
- name: remove overlying workspace
if: ${{ env.VERSION_EXISTS == 'false' }}
run: rm ../../yarn.lock && rm ../../package.json
- name: Install dependencies
if: ${{ env.VERSION_EXISTS == 'false' }}
run: npm install
- name: Build
if: ${{ env.VERSION_EXISTS == 'false' }}
run: npx tsc
- name: Build css
if: ${{ env.VERSION_EXISTS == 'false' }}
run: npx tailwindcss build -o ./dist/data-story.css
- name: Bundle
if: ${{ env.VERSION_EXISTS == 'false' }}
run: npx webpack
- name: Publish
if: ${{ env.VERSION_EXISTS == 'false' }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_DATA_STORY }}