From 6abaeedc716adcbad5ca859721746cf901a8018b Mon Sep 17 00:00:00 2001 From: Xinyu Ma Date: Tue, 16 Jan 2024 14:11:45 -0800 Subject: [PATCH] Add CI --- .github/workflows/publish.yaml | 49 ++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..34bf35a --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,49 @@ +name: Publish + +on: + # Runs on pushes targeting the default branch + push: + # Pattern matched against refs/tags + tags: + - 'v*' # Push events to every tag not containing / + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Down scope as necessary via https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token +permissions: + checks: write + contents: read + +jobs: + publish: + name: Publish NPM package + runs-on: ubuntu-latest + if: github.repository == 'UCLA-IRL/ndnts-aux' + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 21 + cache: "pnpm" + - name: Set up Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + - name: Install dependencies + run: pnpm install + - name: DNT build + run: pnpm build + - name: Login + run: | + pnpm set registry "http://npm.pkg.github.com/" + pnpm set "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" + - name: Publish + run: + cd dist && pnpm publish diff --git a/package.json b/package.json index 4e53e06..87b3c02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ucla-irl/ndnts-aux", - "version": "1.0.1", + "version": "1.0.2", "description": "NDNts Auxiliary Package for Web and Deno", "scripts": { "test": "deno test",