|
| 1 | +name: 'tns-core-modules -> npm' |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'tns-core-modules' ] |
| 6 | + paths: |
| 7 | + - 'nativescript-core/**' |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + NPM_TAG: 'tns-next' |
| 12 | + |
| 13 | +jobs: |
| 14 | + release: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Setup |
| 21 | + run: npm install |
| 22 | + |
| 23 | + - name: Generate Version |
| 24 | + run: | |
| 25 | + echo NPM_VERSION=$(node -e "console.log(require('./package.json').version);")-$NPM_TAG-$(date +"%m-%d-%Y")-$GITHUB_RUN_ID >> $GITHUB_ENV |
| 26 | +
|
| 27 | + - name: Bump Versions |
| 28 | + run: | |
| 29 | + # bump root version |
| 30 | + npm version --no-git-tag-version $NPM_VERSION |
| 31 | +
|
| 32 | + # bump @nativescript/core |
| 33 | + cd nativescript-core |
| 34 | + npm version --no-git-tag-version $NPM_VERSION |
| 35 | + cd .. |
| 36 | +
|
| 37 | + # bump tns-core-modules version & @nativescript/core dep |
| 38 | + cd tns-core-modules-package |
| 39 | + npm version --no-git-tag-version $NPM_VERSION |
| 40 | + cat <<EOT > _bump_core.js |
| 41 | + const {readFileSync: read, writeFileSync: write} = require('fs'), |
| 42 | + p = 'package.json', |
| 43 | + pkg = read(p).toString() |
| 44 | + ver = process.argv.splice(2).join(' '); |
| 45 | + u = pkg.replace(/("@nativescript\/core": ")(?:.+)(")/g, \`\$1\${ver}\$2\`); |
| 46 | + console.log(u) |
| 47 | + write(p, u); |
| 48 | + EOT |
| 49 | + node _bump_core.js $NPM_VERSION |
| 50 | +
|
| 51 | + # for debugging - just show diff |
| 52 | + git diff package.json |
| 53 | + cd .. |
| 54 | +
|
| 55 | + - name: Build @nativescript/core |
| 56 | + run: npm run build-core |
| 57 | + |
| 58 | + - name: Build tns-core-modules |
| 59 | + run: npm run build-compat |
| 60 | + |
| 61 | + - name: Publish @nativescript/core |
| 62 | + working-directory: dist |
| 63 | + env: |
| 64 | + NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
| 65 | + run: | |
| 66 | + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ../.npmrc |
| 67 | +
|
| 68 | + ls -al |
| 69 | +
|
| 70 | + echo "Publishing @nativescript/core@$NPM_VERSION to NPM with tag $NPM_TAG..." |
| 71 | + # npm publish nativescript-core-$NPM_VERSION.tgz --tag $NPM_TAG --dry-run |
| 72 | +
|
| 73 | + echo "Publishing tns-core-modules@$NPM_VERSION to NPM with tag $NPM_TAG..." |
| 74 | + # npm publish tns-core-modules-$NPM_VERSION.tgz --tag $NPM_TAG --dry-run |
0 commit comments