Skip to content

Build and publish Node.js package #6

Build and publish Node.js package

Build and publish Node.js package #6

Workflow file for this run

name: Build and publish Node.js package
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12, macos-14, windows-2019]
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
shell: bash
run: echo ::set-output name=VERSION::"$([[ "$GITHUB_REF" == refs/tags/v* ]] && echo ${GITHUB_REF#refs/tags/v} || echo '0.0.0')"
- name: Set up Node.js
uses: actions/setup-node@v4
- name: Build native module
id: module
shell: bash
run: |
npm install
npm run build-release
npm test
echo ::set-output name=BINARY_NAME::"$(node -e 'console.log([process.platform, process.arch].join("__"))')"
- name: Upload to R2
run: |
node .github/workflows/deploy.js index.node hexo-word-counter/bin/nodejs/${{ steps.version.outputs.VERSION }}/${{ steps.module.outputs.BINARY_NAME }}.node
env:
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}
ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}