diff --git a/.github/release-please/config.json b/.github/release-please/config.json new file mode 100644 index 00000000..5c7c9c3e --- /dev/null +++ b/.github/release-please/config.json @@ -0,0 +1,13 @@ +{ + "release-type": "node", + "packages": { + ".": { + "exclude-paths": [ + "examples/" + ] + } + }, + "bump-minor-pre-major": true, + "bootstrap-sha": "80b158341965d6d3203f68ae2be26d5b6858d65b", + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} diff --git a/.github/release-please/manifest.json b/.github/release-please/manifest.json new file mode 100644 index 00000000..96d9691c --- /dev/null +++ b/.github/release-please/manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0" +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5ba9b41..6d9b0541 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,13 +30,15 @@ jobs: run: sudo apt-get update && sudo apt-get install -y wabt binaryen - name: Rust Cache uses: Swatinem/rust-cache@v2 + - name: Install JS Dependencies + run: npm ci - name: Type Checking run: cargo check --workspace --verbose --locked - - name: Install JS Dependencies - run: npm install - - name: Build + - name: Unit Tests + run: wasm-pack test --headless --firefox + - name: Build Package run: npm run build:dev - - name: Test + - name: Integration Tests run: npm run test api-docs: diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..efbaaf42 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,57 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: Run Release Please +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + releases_created: ${{ steps.release.outputs.releases_created }} + steps: + - uses: google-github-actions/release-please-action@v2 + id: release + with: + release-type: node + config-file: ./.github/release-please/config.json + manifest-file: ./.github/release-please/manifest.json + token: ${{secrets.GITHUB_TOKEN}} + default-branch: main + + publish-to-npm: + runs-on: ubuntu-latest + needs: [ + "release-please" + ] + if: ${{ needs.release-please.outputs.releases_created }} + steps: + # The logic below handles the npm publication: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Setup Rust + uses: dsherret/rust-toolchain-file@v1 + - name: Install wasm-pack + uses: taiki-e/install-action@wasm-pack + - name: Install wasm-strip and wasm-opt + run: sudo apt-get update && sudo apt-get install -y wabt binaryen + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + - name: Install JS Dependencies + run: npm ci + - name: Build Packages + run: npm run build + # Release Please has already incremented versions and published tags, so + # we just need to publish to NPM + - name: Publish to NPM + run: npm publish --access=public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}