chore: core npm prepare handling #523
This file contains hidden or 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: '@nativescript/core -> npm' | |
on: | |
push: | |
branches: [ 'main' ] | |
paths: | |
- 'packages/core/**' | |
workflow_dispatch: | |
env: | |
NPM_TAG: 'next' | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup | |
run: npm run setup | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v4 | |
with: | |
main-branch-name: 'main' | |
- name: Generate Version | |
working-directory: packages/core | |
run: | | |
echo NPM_VERSION=$(node -e "console.log(require('./package.json').version);")-$NPM_TAG-$(date +"%m-%d-%Y")-$GITHUB_RUN_ID >> $GITHUB_ENV | |
- name: Bump Version | |
working-directory: packages/core | |
run: npm version $NPM_VERSION | |
# TODO: build ui-mobile-base first | |
- name: Build @nativescript/core | |
run: npx nx run core:build.npm | |
- name: Publish @nativescript/core | |
working-directory: dist/packages/core | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ../../.npmrc | |
echo "Publishing @nativescript/core@$NPM_VERSION to NPM with tag $NPM_TAG..." | |
npm publish --tag $NPM_TAG |