Skip to content

Commit

Permalink
ci: ✨ update node version
Browse files Browse the repository at this point in the history
  • Loading branch information
12ain committed Jun 3, 2024
1 parent a3da750 commit 003623f
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 73 deletions.
97 changes: 52 additions & 45 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }}
58 changes: 31 additions & 27 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
# with:
# ssh-private-key: ${{ secrets.DEPLOY_KEY }}
# - name: Install SSH Client
# uses: webfactory/[email protected]
# 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Empty file added src/series/.gitkeep
Empty file.

0 comments on commit 003623f

Please sign in to comment.