From 30e528631a95b52895e9cf0f30f9b5ebd9c3aedc Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Sat, 6 Jan 2024 11:27:48 +0100 Subject: [PATCH] Add CI/CD --- .gitea/workflows/publish.yml | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .gitea/workflows/publish.yml diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..aa7d645 --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,45 @@ +name: Publish npm package +on: + release: + types: [published] + +jobs: + build-and-publish: + name: Build and Publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + name: Checkout code + - name: Setup node and npm + uses: actions/setup-node@v3 + with: + node-version: "21.x" + registry-url: "https://git.c0ntroller.de/api/packages/c0ntroller/npm/" + scope: "@c0ntroller" + - id: cache-rustup + name: Cache Rust toolchain + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + ~/.rustup + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }} + name: Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + - name: Build + run: wasm-pack build --target web --release --scope c0ntroller + - name: Publish + run: wasm-pack publish + env: + NODE_AUTH_TOKEN: ${{ secrets.LOCAL_NPM }} \ No newline at end of file