From ac2a0c16a6039f3c4f48137fa50a2833b44f63fe Mon Sep 17 00:00:00 2001 From: duysolo Date: Fri, 5 Aug 2022 08:59:22 +0700 Subject: [PATCH] refactor --- .github/workflows/release-package.yml | 8 +++++--- infrastructure/increase-version.js | 4 ++++ package.json | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml index dd0d66e..c61d0f8 100644 --- a/.github/workflows/release-package.yml +++ b/.github/workflows/release-package.yml @@ -22,6 +22,9 @@ jobs: permissions: packages: write contents: read + env: + NEW_PACKAGE_VERSION: ${{ github.event.release.tag_name }} + NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}} steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -29,10 +32,9 @@ jobs: node-version: 16 registry-url: https://registry.npmjs.org scope: '@mercury-labs' + run: | + echo "The NEW_PACKAGE_VERSION key is:${{env.NEW_PACKAGE_VERSION}}" - run: npm ci - run: npm run build - run: npm run increase-version - run: npm publish - env: - NEW_PACKAGE_VERSION: ${{ github.event.release.tag_name }} - NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}} diff --git a/infrastructure/increase-version.js b/infrastructure/increase-version.js index a754e56..6070a41 100644 --- a/infrastructure/increase-version.js +++ b/infrastructure/increase-version.js @@ -9,6 +9,10 @@ const packageContent = JSON.parse(raw) packageContent.version = process.env.NEW_PACKAGE_VERSION || packageContent.version +console.log({ + newVersion: packageContent.version +}) + fs.writeFileSync( './package.json', JSON.stringify(packageContent, undefined, 2) diff --git a/package.json b/package.json index 6b2c8c0..96146b6 100644 --- a/package.json +++ b/package.json @@ -118,4 +118,4 @@ "publishConfig": { "duysolo:registry": "https://npm.pkg.github.com" } -} +} \ No newline at end of file