diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 00000000..4ec259b5 --- /dev/null +++ b/.github/workflows/cd.yaml @@ -0,0 +1,42 @@ +on: + push: + branches: + - vue-press + +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 + name: Install pnpm + with: + version: 8 + run_install: false + + - 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@releases/v3 + with: + SSH: true + BRANCH: master + FOLDER: public + CLEAN: true diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6339823d..def4afef 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 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..88e601e5 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