From 385d27a9390162bb81c03d55fef58554ce7f2c37 Mon Sep 17 00:00:00 2001 From: Roj Date: Fri, 15 Nov 2024 10:53:25 +0300 Subject: [PATCH] Add CI --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++ .github/workflows/release.yml | 59 +++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..840e1f3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: denoland/setup-deno@v2 + + - run: deno lint + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: denoland/setup-deno@v2 + + - run: deno fmt --check + + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: denoland/setup-deno@v2 + + - run: deno check mod.ts + + - run: deno publish --allow-dirty --dry-run diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0333d85 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +name: Release + +on: + push: + tags: + - "*" + +permissions: + contents: write + id-token: write + +jobs: + publish-jsr: + name: Publish to JSR + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: denoland/setup-deno@v2 + + - run: deno publish + + publish-npm: + name: Publish to npm + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: denoland/setup-deno@v2 + + - uses: actions/setup-node@v3 + with: + node-version: 20.x + registry-url: https://registry.npmjs.org + + - uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Transform and Publish + run: | + deno -A _transform.ts + cd dist + npm publish --access public + env: + __TYPE_MAP: 1 + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + create-release: + name: Create Release + needs: publish-npm + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: softprops/action-gh-release@v1 + with: + prerelease: true + generate_release_notes: true