Skip to content

docs: remove outdated server information and images #31

docs: remove outdated server information and images

docs: remove outdated server information and images #31

name: Deploy to Docker and Github Pages
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "19"
- name: Install Pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
- name: Build project
run: pnpm run build
if: ${{ always() }}
- name: Update version and commit
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
new_version=$(npm version patch -m "chore(release): v%s [skip ci]")
echo "new-version=$new_version" >> $GITHUB_ENV
if: ${{ always() }}
- name: Set Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: ${{ always() }}
- name: Build and push docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
wu529778790/blog.shenzjd.com:${{ env.new-version }}
wu529778790/blog.shenzjd.com:latest
if: ${{ always() }}
- name: Push changes
run: |
git push
if: ${{ always() }}
- name: Deploy to GitHub Pages
run: |
git fetch origin gh-pages
git checkout gh-pages
git rm -rf .
cp -rf docs/.vuepress/dist/* .
echo 'docs/.vuepress/dist/' >> .gitignore
echo 'node_modules/' >> .gitignore
git add .
git commit -m "Deploy to GitHub Pages"
git push -f origin gh-pages
- name: Update Docker
run: |
curl -X POST https://api.shenzjd.com/docker \
-H "Content-Type: application/json" \
-d '{
"dockerName": "wu529778790/blog.shenzjd.com",
"dockerComposeYml": "$(cat docker-compose.yml)"
}'