From 0edc84d546a6902fb52309f2f4303eaee57687e1 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/cd.yaml | 42 +++++++++++++++ .github/workflows/ci.yaml | 96 ++++++++++++++++++----------------- .github/workflows/deploy.yaml | 38 -------------- package.json | 2 +- src/series/.gitkeep | 0 5 files changed, 93 insertions(+), 85 deletions(-) create mode 100644 .github/workflows/cd.yaml delete mode 100644 .github/workflows/deploy.yaml create mode 100644 src/series/.gitkeep diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 00000000..80f6d797 --- /dev/null +++ b/.github/workflows/cd.yaml @@ -0,0 +1,42 @@ +on: + push: + branches: + - vue-press + +permissions: + contents: write + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2 + + - name: Install Node.js 🔧 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Install And Build 🛎️ + run: | + pnpm install && pnpm build + + - 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: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: main + folder: public + clean: true diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6339823d..1ad0a8d0 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 @@ -16,47 +16,51 @@ jobs: contents: read 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 }} + steps: + - 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 + with: + version: 8 + + - 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 deleted file mode 100644 index c7f07391..00000000 --- a/.github/workflows/deploy.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: Auto Deploy GitHub Pages - -on: - push: - branches: - - 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: Install And Build - run: | - yarn - yarn build - - - 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: Deploy - uses: JamesIves/github-pages-deploy-action@releases/v3 - with: - SSH: true - BRANCH: master - FOLDER: public - CLEAN: true diff --git a/package.json b/package.json index 2153d38b..79860829 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "license": "MIT", "scripts": { "dev": "vuepress dev src", - "build": "vuepress build src", + "build": "vuepress build src && mv -f src/.vuepress/dist/* ./public", "deploy": "./scripts/deploy" }, "devDependencies": { diff --git a/src/series/.gitkeep b/src/series/.gitkeep new file mode 100644 index 00000000..e69de29b