Skip to content

Deploy to Production Environment #244

Deploy to Production Environment

Deploy to Production Environment #244

Workflow file for this run

name: Deploy to Production Environment
concurrency: production
on:
# Can be triggered manually
workflow_dispatch:
# Runs every Monday at 20:30 UTC
schedule:
- cron: '30 20 * * 1'
env:
ENV: production
TARGET_REPO_NAME: learn-software-engineering.github.io
SITE_URL: https://learn-software.com
INDEXNOW_KEY: 53f1811377874f608f161d768a9c0b78
jobs:
spell-checker:
runs-on: ubuntu-latest
container: ghcr.io/cn-docker/cspell:9.7.0
steps:
- name: Checkout
uses: actions/checkout@v6
- name: CSpell English
run: task spell-check
build:
needs: spell-checker
runs-on: ubuntu-latest
container: ghcr.io/cn-docker/hugo:v0.159.1
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build with Hugo
run: task build ENV=production
- name: Upload the built site
uses: actions/upload-artifact@v7
with:
name: "site-built-${{ env.TARGET_REPO_NAME }}"
path: public
retention-days: 8
publish:
needs: build
environment: production
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Download the built site
uses: actions/download-artifact@v8
with:
name: "site-built-${{ env.TARGET_REPO_NAME }}"
path: public
- name: Publish site
uses: cpina/github-action-push-to-another-repository@v1.7.3
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_PROD_DEPLOY_KEY }}
with:
source-directory: ./public
destination-github-username: learn-software-engineering
destination-repository-name: ${{ env.TARGET_REPO_NAME }}
target-branch: main
target-directory: docs
commit-message: Publish revision ${{ github.sha }}
user-email: learn.software.eng@gmail.com
index-now:
needs: publish
runs-on: ubuntu-latest
container: ghcr.io/cn-docker/hugo:v0.159.1
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Download the built site
uses: actions/download-artifact@v8
with:
name: "site-built-${{ env.TARGET_REPO_NAME }}"
path: public
- name: Submit URLs to IndexNow
env:
SITE_URL: ${{ env.SITE_URL }}
API_KEY: ${{ env.INDEXNOW_KEY }}
run: task submit-index-now