From d29c9e0e612e890ff8556e9c28184f427eff757c Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 4 Jun 2024 00:33:13 +0800 Subject: [PATCH] ci: :sparkles: update node version --- .github/workflows/ci.yaml | 97 +++++++++++++++++++---------------- .github/workflows/deploy.yaml | 58 +++++++++++---------- 2 files changed, 83 insertions(+), 72 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6339823..def4afe 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,14 +1,14 @@ on: push: branches: - - vue-press + - vue-press env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} COMMENT_SECRET: ${{ secrets.COMMENT_SECRET }} COMMENT_APPID: ${{ secrets.COMMENT_APPID }} - + jobs: build-and-push-image: runs-on: ubuntu-latest @@ -17,46 +17,53 @@ jobs: packages: write steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Build - run: | - yarn - yarn build - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - driver: docker - - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - flavor: | - latest=true - tags: | - type=schedule - type=ref,event=tag - type=sha,prefix=,format=long,enable=true,priority=100 - - - name: Build and push Docker image - uses: docker/build-push-action@v4 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Build + run: | + pnpm install && pnpm build + + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + driver: docker + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + latest=true + tags: | + type=schedule + type=ref,event=tag + type=sha,prefix=,format=long,enable=true,priority=100 + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index c7f0739..4ec259b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,38 +1,42 @@ -name: Auto Deploy GitHub Pages - on: push: branches: - - vue-press + - vue-press jobs: build-and-deploy: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - - uses: actions/setup-node@v3 - with: - node-version: 16 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Install And Build + run: | + pnpm install && pnpm build - - name: Install And Build - run: | - yarn - yarn build + - name: Add Domain + run: cd public && echo 'blog.abplan.top' > CNAME - - name: Add Domain - run: cd public && echo 'blog.abplan.top' > CNAME - - # - name: Install SSH Client - # uses: webfactory/ssh-agent@v0.4.1 - # with: - # ssh-private-key: ${{ secrets.DEPLOY_KEY }} + # - name: Install SSH Client + # uses: webfactory/ssh-agent@v0.4.1 + # with: + # ssh-private-key: ${{ secrets.DEPLOY_KEY }} - - name: Deploy - uses: JamesIves/github-pages-deploy-action@releases/v3 - with: - SSH: true - BRANCH: master - FOLDER: public - CLEAN: true + - name: Deploy + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + SSH: true + BRANCH: master + FOLDER: public + CLEAN: true