Skip to content

Commit

Permalink
Merge pull request #52 from drumath2237/feature/#35-publish-CICD
Browse files Browse the repository at this point in the history
[CI/CD] Use Docker image through Build pipeline
  • Loading branch information
drumath2237 authored Nov 28, 2024
2 parents 78a65df + 5a10752 commit d4e23b8
Show file tree
Hide file tree
Showing 4 changed files with 2,592 additions and 20 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release
on:
pull_request:
branches:
- main
types:
- closed

env:
EM_VERSION: 3.1.72

jobs:
release:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20]
permissions:
contents: read
id-token: write
# releaseブランチからmainにPRがマージされたら
if: |
github.event.pull_request.merged == true
&& startsWith(github.head_ref, 'release/v')
steps:
- uses: actions/checkout@v4

- uses: mymindstorm/setup-emsdk@v14
with:
version: ${{env.EM_VERSION}}

- name: resolve git submodule
run: git submodule update --init --recursive

- name: Build spz wasm binary
run: |
cd ./packages/core/lib/spz-wasm
mkdir ./build
em++ main.cpp \
-Oz \
--closure 1 \
--llvm-lto 1 \
-fno-exceptions \
--std=c++17 \
-lembind \
--emit-tsd main.d.ts \
-o ./build/main.mjs \
-s USE_ZLIB=1 \
-s WASM=1 \
-s SINGLE_FILE=1 \
-s MODULARIZE=1 \
-s EXPORT_ES6=1 \
-s EXPORT_NAME="spzwasm" \
-s ALLOW_MEMORY_GROWTH \
-s EXPORTED_FUNCTIONS="['_malloc', '_free']"
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Publish
run: pnpm publish:all
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 11 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json",
"version": "0.0.0",
"packages": ["packages/*"],
"npmClient": "pnpm",
"command": {
"version": {
"allowBranch": ["release/v*"]
}
}
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@
"build:vite": "pnpm -r run build",
"build:wasm": "pnpm -F @spz-loader/core run build:docker",
"build:all": "pnpm run build:wasm && pnpm run build:vite",
"build": "pnpm run build:vite"
"build": "pnpm run build:vite",
"version:set": "pnpm exec lerna version",
"publish:all": "NPM_CONFIG_PROVENANCE=true pnpm publish --filter \"@spz-loader/*\" --access public"
},
"engines": {
"node": ">=16",
"pnpm": ">=8"
},
"license": "Apache-2.0",
"devDependencies": {
"@biomejs/biome": "1.9.4"
"@biomejs/biome": "1.9.4",
"@lerna-lite/cli": "^3.10.0",
"@lerna-lite/version": "^3.10.0"
}
}
Loading

0 comments on commit d4e23b8

Please sign in to comment.