-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add CI and release workflows (#4)
- Loading branch information
Showing
7 changed files
with
130 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Release Crate | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
registries: | ||
name: Publish to Crates.io | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: Set version | ||
run: | | ||
# Remove the "v" from the version. | ||
VERSION=$(echo ${{ github.ref_name }} | cut -b2-) | ||
echo "Version: ${VERSION}" | ||
sed -i 's/version = "0.0.0-git"/version = "'${VERSION}'"/' Cargo.toml | ||
sed -i 's/version = "0.0.0-git"/version = "'${VERSION}'"/' Cargo.lock | ||
- name: Publish to crates.io | ||
run: | | ||
cargo publish --allow-dirty | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} |
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,48 @@ | ||
name: Release NPM | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
registries: | ||
name: Publish to GitHub NPM | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node toolchain | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: Install wasm-pack | ||
run: | | ||
cargo install wasm-pack | ||
- name: Set version | ||
run: | | ||
# Remove the "v" from the version. | ||
VERSION=$(echo ${{ github.ref_name }} | cut -b2-) | ||
echo "Version: ${VERSION}" | ||
sed -i 's/version = "0.0.0-git"/version = "'${VERSION}'"/' Cargo.toml | ||
- name: Create NPM package | ||
run: | | ||
wasm-pack build --release | ||
sed -i s%nile-library%@nile/library% pkg/package.json | ||
- uses: JS-DevTools/npm-publish@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
registry: "https://npm.pkg.github.com" | ||
package: pkg/package.json |
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,36 @@ | ||
name: Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
testing: | ||
name: Testing | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: Install wasm-pack | ||
run: | | ||
cargo install wasm-pack | ||
- name: Build library | ||
run: | | ||
wasm-pack build --release --target web | ||
cargo build --release | ||
- name: Check coding style | ||
run: | | ||
cargo fmt --check |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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