Skip to content

Commit

Permalink
ci: Polish scripts and prepare for releasing
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Mar 10, 2023
1 parent 2a6c522 commit d865a70
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 11 deletions.
119 changes: 116 additions & 3 deletions .github/workflows/bindings_nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.

name: Binding NodeJS CI

env:
DEBUG: napi:*
APP_NAME: opendal
MACOSX_DEPLOYMENT_TARGET: '10.13'

on:
Expand All @@ -31,8 +31,7 @@ on:
workflow_dispatch:

jobs:
test:
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
linux:
strategy:
fail-fast: false
matrix:
Expand All @@ -59,5 +58,119 @@ jobs:
run: yarn install
- name: Build
run: yarn build
- uses: actions/upload-artifact@v3
with:
name: bindings-linux
path: bindings/nodejs/*.node
- name: Test bindings
run: yarn test

windows:
strategy:
fail-fast: false
matrix:
node:
- '18'
runs-on: windows-latest

# Notes: this defaults only apply on run tasks.
defaults:
run:
working-directory: "bindings/nodejs"

steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
- name: Corepack
run: corepack enable
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build
- uses: actions/upload-artifact@v3
with:
name: bindings-windows
path: bindings/nodejs/*.node
- name: Test bindings
run: yarn test

macos:
strategy:
fail-fast: false
matrix:
node:
- '18'
runs-on: macos-latest

# Notes: this defaults only apply on run tasks.
defaults:
run:
working-directory: "bindings/nodejs"

steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
- name: Corepack
run: corepack enable
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build
- uses: actions/upload-artifact@v3
with:
name: bindings-macos
path: bindings/nodejs/*.node
- name: Test bindings
run: yarn test

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [macos, linux, windows]

# Notes: this defaults only apply on run tasks.
defaults:
run:
working-directory: "bindings/nodejs"

steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
- name: Corepack
run: corepack enable
- name: Install dependencies
run: yarn install

- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: bindings/nodejs/artifacts
- name: Move artifacts
run: yarn artifacts

- name: List packages
run: ls -R ./npm
shell: bash
- name: Publish
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions bindings/nodejs/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opendal-darwin-x64",
"version": "0.0.0",
"version": "0.0.1",
"os": [
"darwin"
],
Expand All @@ -15,4 +15,4 @@
"engines": {
"node": ">= 10"
}
}
}
4 changes: 2 additions & 2 deletions bindings/nodejs/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opendal-linux-x64-gnu",
"version": "0.0.0",
"version": "0.0.1",
"os": [
"linux"
],
Expand All @@ -18,4 +18,4 @@
"libc": [
"glibc"
]
}
}
4 changes: 2 additions & 2 deletions bindings/nodejs/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opendal-win32-x64-msvc",
"version": "0.0.0",
"version": "0.0.1",
"os": [
"win32"
],
Expand All @@ -15,4 +15,4 @@
"engines": {
"node": ">= 10"
}
}
}
9 changes: 7 additions & 2 deletions bindings/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,10 @@
"test": "ava",
"version": "napi version"
},
"packageManager": "[email protected]+sha224.cca891d4a8671d4898aba3426674bb734dbbf88cef82dd4dacd71c9f"
}
"packageManager": "[email protected]+sha224.cca891d4a8671d4898aba3426674bb734dbbf88cef82dd4dacd71c9f",
"optionalDependencies": {
"opendal-win32-x64-msvc": "0.0.1",
"opendal-darwin-x64": "0.0.1",
"opendal-linux-x64-gnu": "0.0.1"
}
}

1 comment on commit d865a70

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for opendal ready!

✅ Preview
https://opendal-8u8t1aafw-databend.vercel.app
https://opendal-git-polish-ci.vercel.app

Built with commit d865a70.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.