week 7 progress details added #31
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
name: Deploy website to FTP | |
on: | |
# Trigger the workflow every time you push to the `main` branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab on GitHub. | |
workflow_dispatch: | |
# Provide permission to clone the repo and deploy it to FTP | |
permissions: | |
contents: read | |
id-token: write | |
concurrency: | |
group: "ftp-deployment" | |
cancel-in-progress: false | |
jobs: | |
# Build website | |
build: | |
if: github.repository_owner != 'HugoBlox' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Fetch history for Hugo's .GitInfo and .Lastmod | |
fetch-depth: 0 | |
node-version: 20 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "0.123.7" | |
extended: true | |
- uses: actions/cache@v3 | |
with: | |
path: /tmp/hugo_cache_runner/ | |
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod') }} | |
restore-keys: | | |
${{ runner.os }}-hugomod- | |
- name: Debug Secrets | |
run: | | |
echo "FTP Server Address: ${{ secrets.FTP_SERVER_ADDRESS }}" | |
echo "FTP Username: ${{ secrets.FTP_USERNAME }}" | |
echo "FTP Password: ${{ secrets.FTP_PASSWORD }}" | |
echo "FTP Port: ${{ secrets.FTP_PORT }}" | |
- name: Build with Hugo | |
env: | |
HUGO_ENVIRONMENT: production | |
run: | | |
echo "Hugo Cache Dir: $(hugo config | grep cachedir)" | |
hugo --minify | |
- name: Generate Pagefind search index | |
run: npx pagefind --source "public" | |
- name: Upload to FTP | |
uses: SamKirkland/[email protected] | |
with: | |
server: ${{ secrets.FTP_SERVER_ADDRESS }} | |
username: ${{ secrets.FTP_USERNAME }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
protocol: ftps | |
local-dir: "./public/" | |
port: ${{ secrets.FTP_PORT }} |