Deploy Hugo site to Server #173
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample workflow for building and deploying a Hugo site to GitHub Pages | |
name: Deploy Hugo site to Server | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ['master'] | |
workflow_run: | |
workflows: ['Update theme'] | |
types: | |
- completed | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Default to bash | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
# Deployment job | |
deploy: | |
environment: web-site-deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: ${{ vars.HUGO_VERSION || 'latest'}} | |
extended: true | |
- name: Clean last public | |
run: rm -rf public | |
- name: Build with Hugo | |
run: hugo --logLevel=warn --gc --minify | |
- name: copy file via ssh key | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
host: ${{ secrets.TENCENTCLOUD_SECRET_HOST }} | |
username: ${{ secrets.TENCENTCLOUD_SECRET_USERNAME }} | |
key: ${{ secrets.TENCENTCLOUD_SECRET_KEY }} | |
port: ${{ secrets.TENCENTCLOUD_SECRET_PORT }} | |
source: './public/*' | |
target: ${{ secrets.TENCENTCLOUD_SECRET_TRAGET_PATH }} |