Skip to content

Update fast-copy.ps1 #956

Update fast-copy.ps1

Update fast-copy.ps1 #956

Workflow file for this run

on:
push:
branches:
- main
jobs:
deploy:
if: ${{ contains(github.event.head_commit.message,'--ci') }}
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v1
- name: install hugo
env:
HUGO_VERSION: 0.130.0
run: |
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb -O hugo.deb
sudo dpkg -i hugo.deb
sudo timedatectl set-timezone Asia/Shanghai
- name: use hugo generate static web site
run: |
export HUGO_PARAMS_GitLastHash=${GITHUB_SHA}
hugo --environment production --panicOnWarning --config hugo.yml
- name: init static web site git repo
working-directory: .www
run: |
git init
git config user.name 'GitHub Actions'
git config user.email '[email protected]'
git add .
git commit -m "GitHub Actions Auto Deploy" -m "https://github.com/linianhui/blog/commit/${GITHUB_SHA}"
- name: add github ssh private key
env:
PUSH_GITHUB_SSH_PRIVATE_KEY: ${{secrets.PUSH_GITHUB_SSH_PRIVATE_KEY}}
run: |
mkdir -p ~/.ssh/
echo "${PUSH_GITHUB_SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: deploy to https://linianhui.github.io
working-directory: .www
run: git push --force [email protected]:linianhui/linianhui.github.io.git HEAD:main
- name: submit sitemap to bing
# https://www.bing.com/webmaster/help/how-to-submit-sitemaps-82a15bd4
run: curl http://www.bing.com/ping?sitemap=https%3A%2F%2Flinianhui.github.io/sitemap.xml
- name: submit sitemap to google
# https://support.google.com/webmasters/answer/183668
run: curl http://www.google.com/ping?sitemap=https%3A%2F%2Flinianhui.github.io/sitemap.xml