Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(crypto-js): Add a release workflow for crypto-js #966

Merged
merged 3 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/release_crypto_js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow releases the `matrix-sdk-crypto-js` project.
#
# It is triggered when a new tag appears that matches
# `matrix-sdk-crypto-js-v[0-9]+.*`. This workflow builds the package
# for the binding, run its tests to ensure everything is still
# correct, and publish the package on NPM and on a newly created
# Github release.


name: Release `crypto-js`

env:
CARGO_TERM_COLOR: always
PKG_PATH: "bindings/matrix-sdk-crypto-js"

on:
push:
tags:
- matrix-sdk-crypto-js-v[0-9]+.*

jobs:
publish-matrix-sdk-crypto-js:
name: Publish 🕸 [m]-crypto-js

runs-on: ubuntu-latest

steps:
- name: Checkout the repo
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
profile: minimal
override: true

- name: Load cache
uses: Swatinem/rust-cache@v1

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.0

- name: Install NPM dependencies
working-directory: ${{ env.PKG_PATH }}
run: npm install

- name: Configure NPM auth token
working-directory: ${{ env.PKG_PATH }}
run: npm set "//registry.npmjs.org/:_authToken" "${{ secrets.NPM_TOKEN }}"

- name: Publish the WebAssembly + JavaScript binding (imply building + testing)
working-directory: ${{ env.PKG_PATH }}
run: npm run publish

- name: Create the Github release
uses: softprops/action-gh-release@v1
with:
draft: true
files: ${{ env.PKG_PATH }}/pkg/matrix-org-matrix-sdk-crypto-js-*.tgz
4 changes: 3 additions & 1 deletion bindings/matrix-sdk-crypto-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"scripts": {
"build": "cross-env RUSTFLAGS='-C opt-level=z' wasm-pack build --release --target nodejs --scope matrix-org --out-dir ./pkg",
"test": "jest --verbose",
"doc": "typedoc --tsconfig ."
"doc": "typedoc --tsconfig .",
"prepublish": "$npm_execpath run build && $npm_execpath run test",
"publish": "wasm-pack pack && wasm-pack publish"
}
}