diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..1476fc9 --- /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 bundler --release --scope c0ntroller + - name: Publish + run: wasm-pack publish + env: + NODE_AUTH_TOKEN: ${{ secrets.LOCAL_NPM }} \ No newline at end of file