-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create action for publishing packages
- Loading branch information
Showing
2 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Publish Package to npmjs and GitHub Package Registry | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
build-wasm: | ||
runs-on: ubuntu-22.04 | ||
container: emscripten/emsdk:3.1.36 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
repository: "taku910/mecab" | ||
path: mecab | ||
- run: emconfigure mecab/mecab/configure --enable-static=true --enable-shared=false --enable-utf8-only | ||
- run: emmake make CXXFLAGS='-O3 -Wall -std=c++11' | ||
- run: mkdir out | ||
- run: >- | ||
emcc -O3 -Wall -std=c++11 | ||
-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=2147483648 | ||
-sENVIRONMENT=worker -sEXPORT_ES6=1 -sMODULARIZE=1 -sEXPORT_NAME=createModule | ||
-sEXPORTED_FUNCTIONS=_malloc,_free,_mecab_new,_mecab_sparse_tostr,_mecab_sparse_tonode | ||
-sEXPORTED_RUNTIME_METHODS=cwrap,writeAsciiToMemory,UTF8ToString,setValue,getValue,FS,WORKERFS | ||
-l'workerfs.js' | ||
src/.libs/libmecab.a | ||
-o out/mecab.js | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: mecab-wasm | ||
path: out/ | ||
if-no-files-found: error | ||
publish-npm: | ||
needs: build-wasm | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: mecab-wasm | ||
path: src/ | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: "https://registry.npmjs.org" | ||
- run: npm ci | ||
- run: npm run build | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
publish-github: | ||
needs: build-wasm | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: mecab-wasm | ||
path: src/ | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: "https://npm.pkg.github.com" | ||
- run: npm ci | ||
- run: npm run build | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |