From 112d3ed39979dea45a0aef45c82c6364e78a134d Mon Sep 17 00:00:00 2001 From: TechQuery Date: Thu, 18 Jan 2024 04:14:23 +0800 Subject: [PATCH] [fix] NPM ignore & GitHub actions bugs --- .github/workflows/main.yml | 24 ++++++++++++++---------- .github/workflows/push.yml | 2 +- .npmignore | 3 ++- package.json | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2fdbf8e..37877ae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,10 @@ name: CI & CD on: push: - branches: - - master + tags: + - v* jobs: - Build-and-Deploy: + Build-and-Publish: env: VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} @@ -19,20 +19,24 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 + registry-url: https://registry.npmjs.org cache: pnpm - - name: Install & Build - run: | - pnpm i --frozen-lockfile - pnpm build + - name: Install Dependencies + run: pnpm i --frozen-lockfile + + - name: Build & Publish + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Deploy to GitHub pages uses: peaceiris/actions-gh-pages@v3 with: - publish_dir: ./dist + publish_dir: ./docs personal_token: ${{ secrets.GITHUB_TOKEN }} force_orphan: true - - name: Deploy to Vercel + - name: Deploy to Vercel preview uses: amondnet/vercel-action@v25 if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }} with: @@ -40,5 +44,5 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} - working-directory: ./dist + working-directory: ./docs vercel-args: --prod diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a791585..3afe952 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -32,4 +32,4 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} - working-directory: ./dist + working-directory: ./docs diff --git a/.npmignore b/.npmignore index d56517a..bf61294 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,8 @@ .editorconfig .eslintrc.json test/ -.cache/ +.parcel* docs/ .vscode/ +.husky/ .github/ diff --git a/package.json b/package.json index 7b7272a..e506d88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-web-widget", - "version": "4.0.0-rc.0", + "version": "4.0.0-rc.1", "description": "Web Components library for GitHub based on WebCell", "keywords": [ "github",