feat(node): upgrades to support Node 18, 20 #120 #133
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Merge to master | |
on: | |
push: | |
branches: | |
- master | |
release: | |
types: [created] | |
env: | |
GIT_USER: 'GitHub Actions' | |
GIT_EMAIL: 'github-actions[bot]@users.noreply.github.com' | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} | |
strategy: | |
matrix: | |
os: [windows-2019, macos-latest, ubuntu-latest] | |
node-version: [16, 18, 20] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Set git credentials | |
run: | | |
git config --global user.email ${{ env.GIT_USER }} | |
git config --global user.name ${{ env.GIT_EMAIL }} | |
- name: Install dependencies | |
run: yarn | |
- name: Create initial release | |
run: yarn release | |
- name: Build binaries | |
run: yarn build | |
- name: Run tests | |
run: yarn test | |
- name: Report coverage | |
run: yarn codecov | |
- name: Upload js bundle | |
uses: actions/upload-artifact@v2 | |
with: | |
name: js-bundle | |
path: dist | |
- name: Upload binary artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: binary-artifact | |
path: build/stage | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Pull latest | |
run: git pull origin master | |
- name: Install Vuepress | |
run: yarn add vuepress@next -D | |
- name: Build documentation | |
run: yarn docs:build | |
- name: Create CNAME Record | |
run: echo "symbology.dev" > build/docs/CNAME | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GIT_CONFIG_NAME: ${{ env.GIT_USER }} | |
GIT_CONFIG_EMAIL: ${{ env.GIT_EMAIL }} | |
BRANCH: gh-pages | |
FOLDER: build/docs | |
CLEAN: true | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: TriPSs/conventional-changelog-action@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
git-user-name: ${{ env.GIT_USER }} | |
git-user-email: ${{ env.GIT_EMAIL }} | |
tag-prefix: 'v' | |
release-count: '0' | |
skip-on-empty: false | |
upload-binaries: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download binary artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: binary-artifact | |
path: build/stage | |
- name: Upload binary artifacts to release | |
# only one folder will be present in build/stage, which is named the new version number | |
# extract this name and set it as the release name, then upload artifact binaries to it | |
run: | | |
set -x | |
assets=() | |
for asset in ./build/stage/**/*; do | |
assets+=("-a" "$asset") | |
done | |
RELEASE_VERSION=$(echo $(ls build/stage| head -1)) | |
hub release create "${assets[@]}" -m "v$RELEASE_VERSION" "$RELEASE_VERSION" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-npm: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Pull latest | |
run: git pull origin master | |
- name: Download js bundle | |
uses: actions/download-artifact@v2 | |
with: | |
name: js-bundle | |
path: dist | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |