feat: Support adding npm packages to the eszip (#192) #898
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
name: ci | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
RUST_BACKTRACE: full | |
# https://github.com/rust-unofficial/patterns/blob/master/anti_patterns/deny-warnings.md | |
RUSTFLAGS: -D warnings | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install rust | |
uses: dsherret/rust-toolchain-file@v1 | |
- name: Install Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: 1.x | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Clippy | |
run: | | |
cargo clippy --all-targets --locked --no-default-features | |
cargo clippy --all-targets --locked | |
cargo clippy --all-targets --locked --all-features | |
- name: Build | |
run: deno task build && deno task node | |
- name: Test | |
run: | | |
cargo test --all-features --locked | |
deno task test | |
- name: Get tag version | |
if: startsWith(github.ref, 'refs/tags/') | |
id: get_tag_version | |
run: echo TAG_VERSION=${GITHUB_REF/refs\/tags\//} >> "$GITHUB_OUTPUT" | |
- name: Publish deno.land/x | |
uses: denoland/publish-folder@82ce065074e7174baf444332c4b7c40869a4909a | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
folder: js | |
branch: deno_registry | |
tag: deno/${{ steps.get_tag_version.outputs.TAG_VERSION }} | |
token: ${{ secrets.DENOBOT_PAT }} | |
git-user-name: denobot | |
git-user-email: [email protected] | |
- name: Build npm | |
run: deno run -A ./build_npm.ts ${{ github.ref_name }} | |
- name: Publish npm | |
if: | | |
github.repository == 'denoland/eszip' && | |
startsWith(github.ref, 'refs/tags/') | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
cargo publish | |
cd npm/ && npm publish |