Skip to content

Commit

Permalink
Node workflow - Add version to commit, simplify cmake commands (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
acalcutt authored Sep 28, 2022
1 parent 14b0d04 commit 60d63c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/node-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ on:
required: true
type: choice
options:
- prerelease
- prerelease
- prepatch
- preminor
- premajor
- patch
- minor
- major
Expand All @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -216,15 +226,15 @@ 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
env:
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
Expand Down

0 comments on commit 60d63c7

Please sign in to comment.