fix: sdk and ui-kit packages build in clean project #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish SDK package | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- sdk@[0-9]+.[0-9]+.[0-9]+* | |
paths: | |
- packages/sdk/** | |
permissions: | |
contents: read | |
packages: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
working-directory: packages/sdk | |
jobs: | |
build: | |
runs-on: self-hosted # ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- id: package-tag | |
name: Determine tag for package | |
shell: bash | |
run: | | |
if [ "${{ github.event_name }}" = "schedule" ]; then | |
VERSION="nightly" | |
elif [[ $GITHUB_REF == refs/heads/develop ]]; then | |
VERSION="latest" | |
elif [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
elif [[ $GITHUB_REF == refs/heads/release/* ]]; then | |
VERSION="release" | |
elif [[ $GITHUB_REF == refs/heads/* ]]; then | |
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') | |
elif [[ $GITHUB_REF == refs/pull/* ]]; then | |
VERSION=pr-${{ github.event.number }} | |
fi | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
echo "::set-output name=version::$(echo $VERSION)" | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Enable Corepack | |
run: corepack enable | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@momentum-xyz' | |
- id: yarn-deps | |
name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- id: build | |
name: Yarn build | |
run: yarn run build | |
- id: publish | |
name: Publish NPM package | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: yarn publish --non-interactive --no-git-tag-version --access public --tag $VERSION |