Skip to content

Commit

Permalink
create action for publishing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
leyhline committed May 6, 2023
1 parent b66e0de commit efa32a3
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
-o out/mecab.js
- uses: actions/upload-artifact@v3
with:
name: mecab
name: mecab-wasm
path: out/
if-no-files-found: error
test:
Expand All @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: mecab
name: mecab-wasm
path: src/
- uses: actions/setup-node@v3
with:
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/publish.yaml
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 }}

0 comments on commit efa32a3

Please sign in to comment.