Skip to content

@underdog-protocol/ui setup #7

@underdog-protocol/ui setup

@underdog-protocol/ui setup #7

Workflow file for this run

name: Node.js Package CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [created]
jobs:
build-and-publish:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn install
- name: Bump package version
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
yarn version --patch --no-git-tag-version
echo "NEW_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: Create and push git tag for new version
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git commit -am "chore: bump version to ${{ env.NEW_VERSION }}"
git tag "v${{ env.NEW_VERSION }}"
git push https://${{ secrets.ORG_GITHUB_PAT }}@github.com/UnderdogProtocol/ui.git "v${{ env.NEW_VERSION }}" --force
git push https://${{ secrets.ORG_GITHUB_PAT }}@github.com/UnderdogProtocol/ui.git --force
env:
ORG_GITHUB_PAT: ${{ secrets.ORG_GITHUB_PAT }}
- name: Build
run: yarn build
- name: Publish to npm
run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}