From 340371d31cdbaedcc0f9a1e656f3054bdc1c960f Mon Sep 17 00:00:00 2001 From: rigor789 Date: Fri, 17 Jul 2020 22:16:25 +0200 Subject: [PATCH 1/6] ci: add publish workflow (WIP) --- .github/workflows/npm_release.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/npm_release.yml diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml new file mode 100644 index 000000000..2f5640af0 --- /dev/null +++ b/.github/workflows/npm_release.yml @@ -0,0 +1,31 @@ +name: Release @nativescript/core to NPM + +on: + push: + branches: [ 'feat/monorepo' ] + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup + run: npm run setup + + - name: Generate Version + working-directory: packages/core + run: echo ::set-env name=NPM_VERSION::$(node -e "console.log(require('./package.json').version);")--$(date +"%m-%d-%Y-%s")-$GITHUB_RUN_NUMBER + + - name: Bump Version + working-directory: packages/core + run: npm version $NPM_VERSION + + - name: Build @nativescript/core + run: npx nx run core:build.npm + + - name: Publish @nativescript/core + run: | + echo dist/nativescript-core-$NPM_VERSION.tgz + echo Publishing to NPM... From c57cd55eaf672f7dee361092786c3be65def81a9 Mon Sep 17 00:00:00 2001 From: rigor789 Date: Fri, 17 Jul 2020 22:23:57 +0200 Subject: [PATCH 2/6] ci: add npm token as env variable --- .github/workflows/npm_release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index 2f5640af0..fba437860 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup - run: npm run setup + run: npm ci - name: Generate Version working-directory: packages/core @@ -26,6 +26,8 @@ jobs: run: npx nx run core:build.npm - name: Publish @nativescript/core + env: + NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} run: | echo dist/nativescript-core-$NPM_VERSION.tgz echo Publishing to NPM... From dd4a4bb58c66889a40cf7396d1a5e4a09499b79a Mon Sep 17 00:00:00 2001 From: rigor789 Date: Fri, 17 Jul 2020 22:25:33 +0200 Subject: [PATCH 3/6] ci: use regular install --- .github/workflows/npm_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index fba437860..a32f21107 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup - run: npm ci + run: npm install - name: Generate Version working-directory: packages/core From 026632bdd7490faacc030d8321179e709e4394c6 Mon Sep 17 00:00:00 2001 From: rigor789 Date: Fri, 17 Jul 2020 22:57:25 +0200 Subject: [PATCH 4/6] ci: add authToken to npmrc --- .github/workflows/npm_release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index a32f21107..9999f3b3f 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -29,5 +29,7 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} run: | + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc echo dist/nativescript-core-$NPM_VERSION.tgz echo Publishing to NPM... + npm publish dist/nativescript-core-$NPM_VERSION.tgz --tag ci --dry-run From 87bd1cdd0211f5f61b2a11982e00ce4afb10a035 Mon Sep 17 00:00:00 2001 From: rigor789 Date: Fri, 17 Jul 2020 23:02:58 +0200 Subject: [PATCH 5/6] ci: change message and working dir --- .github/workflows/npm_release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index 9999f3b3f..6527b9066 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -26,10 +26,10 @@ jobs: run: npx nx run core:build.npm - name: Publish @nativescript/core + working-directory: dist env: NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc - echo dist/nativescript-core-$NPM_VERSION.tgz - echo Publishing to NPM... - npm publish dist/nativescript-core-$NPM_VERSION.tgz --tag ci --dry-run + echo "Publishing @nativescript/core@$NPM_VERSION to NPM..." + npm publish nativescript-core-$NPM_VERSION.tgz --tag ci --dry-run From 9ab6707d2264f4592892f9bb8f4a4feec7375e84 Mon Sep 17 00:00:00 2001 From: rigor789 Date: Fri, 17 Jul 2020 23:11:20 +0200 Subject: [PATCH 6/6] ci: use correct cwd --- .github/workflows/npm_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index 6527b9066..76e43ca4d 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -26,7 +26,7 @@ jobs: run: npx nx run core:build.npm - name: Publish @nativescript/core - working-directory: dist + working-directory: dist/packages env: NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} run: |