From b5d3382be7cd4cfed87be339cd77dcca0976f4d3 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 28 Oct 2023 14:22:25 +0200 Subject: [PATCH] chore: add GitHub release workflow to release on GitHub's NPM (#2) --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ Cargo.toml | 5 +++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cfdbe8d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +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: '16' + + - 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}" + + cargo set-version ${VERSION} + + - name: Create NPM package + run: | + wasm-pack build --release + sed -i s%esf-dogma-engine%@EVEShipFit/dogma-engine% pkg/package.json + + - uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + registry: "https://npm.pkg.github.com" + package: pkg/package.json diff --git a/Cargo.toml b/Cargo.toml index e9a59a5..b9b3d6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,11 @@ [package] -name = "dogma-engine" +name = "esf-dogma-engine" version = "0.0.0-git" authors = ["Patric Stout "] edition = "2021" +repository = "https://github.com/EVEShipFit/dogma-engine" +description = "Library to calculate statistics for EVE Online ship fits" +license = "MIT" [lib] crate-type = ["cdylib", "rlib"]