Skip to content

Hugo CI

Hugo CI #91

Workflow file for this run

name: Hugo CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
jobs:
staging:
name: Deploy to staging
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.111.3'
- name: Build
run: hugo --baseURL ${{ secrets.HUGO_STAGING_BASEURL }} --destination blog-staging -D
- name: copy file via ssh password
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOSTNAME }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
source: "blog-staging"
target: ${{ secrets.SSH_WORKDIR }}
production:
name: Deploy to production
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.111.3'
- name: Build
run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.GITHUB_TOKEN }}
cname: blog.jcatania.io
- name: Git Push
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git tag v${{ github.event.inputs.version }}
git push --tags
- uses: "marvinpinto/action-automatic-releases@latest"
name: Create GH Release
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false