From edf74fc1ec6543af5844c666187659700b68699e Mon Sep 17 00:00:00 2001 From: Maxime Guerreiro Date: Sun, 20 Dec 2020 14:28:04 +0100 Subject: [PATCH] feat(wasm-web): Initialize --- .github/workflows/publish-wasm-web.yml | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/publish-wasm-web.yml diff --git a/.github/workflows/publish-wasm-web.yml b/.github/workflows/publish-wasm-web.yml new file mode 100644 index 00000000000..a4532b18979 --- /dev/null +++ b/.github/workflows/publish-wasm-web.yml @@ -0,0 +1,52 @@ +name: Publish (wasm for web) + +env: + CARGO_INCREMENTAL: 0 + CI: "1" + +on: + create: + tags: + - v* + +jobs: + build: + name: Build - wasm for web + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/ + **/target/ + key: ${{ runner.os }}-publish-integration + + - name: Install node dependencies + run: npm i + + - name: Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + - name: Build + run: (cd wasm && wasm-pack build --release --scope=swc) + + - name: Rename + run: | + sed -i'' -e 's/"name": "@swc\/wasm"/"name": "@swc\/wasm-web"/g' package.json + working-directory: wasm/pkg + + - name: Publish + run: | + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + (cd wasm/pkg && npm publish) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }}