From 60d63c7fe07611ac49e4a156f88a7bc3de5cd594 Mon Sep 17 00:00:00 2001 From: Andrew Calcutt Date: Wed, 28 Sep 2022 08:49:15 -0400 Subject: [PATCH] Node workflow - Add version to commit, simplify cmake commands (#514) --- .github/workflows/node-ci.yml | 4 ++-- .github/workflows/node-release.yml | 24 +++++++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index c936a25f6..966c82884 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -167,12 +167,12 @@ jobs: - name: CMake if: runner.os == 'MacOS' run: | - cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DMBGL_WITH_COVERAGE=ON + cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} - name: CMake if: runner.os == 'Linux' run: | - cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 + cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 - name: Build run: | diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.yml index e168e54ab..27e362d85 100644 --- a/.github/workflows/node-release.yml +++ b/.github/workflows/node-release.yml @@ -8,7 +8,10 @@ on: required: true type: choice options: - - prerelease + - prerelease + - prepatch + - preminor + - premajor - patch - minor - major @@ -33,11 +36,18 @@ jobs: with: node-version: 18 - - name: Bump Version + - name: npm version + id: npmversion + run: >- + echo "::set-output name=NPM_VERSION::$( + npm version ${{ github.event.inputs.version }} --preid pre --no-git-tag-version + )" + + - name: Push version to git run: | git config user.name github-actions git config user.email github-actions@github.com - npm version ${{ github.event.inputs.version }} --preid pre -m "Update node version to (${{ github.event.inputs.version }})" + git commit -a -m "Update node version to ${{ steps.npmversion.outputs.NPM_VERSION }} (${{ github.event.inputs.version }})" git push publish_binaries: @@ -139,12 +149,12 @@ jobs: - name: CMake if: runner.os == 'MacOS' run: | - cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DMBGL_WITH_COVERAGE=ON + cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} - name: CMake if: runner.os == 'Linux' run: | - cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 + cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 - name: Build run: | @@ -216,7 +226,7 @@ jobs: node-version: 18 - name: Publish to NPM (release) - if: github.ref == 'refs/heads/main' && github.event.inputs.version != 'prerelease' + if: github.ref == 'refs/heads/main' && (github.event.inputs.version == 'patch' || github.event.inputs.version == 'minor' || github.event.inputs.version == 'major') run: | npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} npm publish --access public @@ -224,7 +234,7 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }} - name: Publish to NPM (prerelease) - if: github.ref == 'refs/heads/main' && github.event.inputs.version == 'prerelease' + if: github.ref == 'refs/heads/main' && (github.event.inputs.version == 'prerelease' || github.event.inputs.version == 'prepatch' || github.event.inputs.version == 'preminor' || github.event.inputs.version == 'premajor') run: | npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} npm publish --tag next --access public