gitsubmodules: Bump .linters from 9a512fe
to 174ed89
#100
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: wrangler.yaml | |
# Description: | |
# A Workflow that builds a static website using | |
# Hugo before publishing to Cloudflare Workers | |
# with the Wrangler CLI | |
################################################## | |
name: Wrangler | |
on: | |
# Automatically run anytime there | |
# is a push to the default branch | |
push: | |
branches: | |
- trunk | |
# Automatically run anytime a PR | |
# targets the default branch | |
# for the defined types. | |
pull_request: | |
branches: | |
- trunk | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- review_requested | |
permissions: | |
contents: read | |
pull-requests: write | |
checks: read | |
statuses: read | |
defaults: | |
run: | |
shell: bash | |
env: | |
HUGO_VERSION: 0.124.1 | |
BRANCH_NAME_CURRENT: ${{ github.head_ref || github.ref_name }} | |
BRANCH_NAME_DEFAULT: ${{ github.event.repository.default_branch }} | |
jobs: | |
################################################## | |
# Publish to Cloudflare Workers using the Wrangler CLI | |
################################################## | |
deploy: | |
name: Publish website | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu-latest | |
steps: | |
- id: checkout_repository | |
name: Checkout repository with submodules | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
clean: true | |
persist-credentials: true | |
- id: hugo_install | |
name: Download and Install Hugo | |
run: | | |
wget https://github.com/gohugoio/hugo/releases/download/v${{ env.HUGO_VERSION }}/hugo_extended_${{ env.HUGO_VERSION }}_linux-amd64.deb | |
sudo dpkg -i hugo_extended_${{ env.HUGO_VERSION }}_linux-amd64.deb | |
hugo version | |
- id: hugo_cleanup | |
name: Remove unwanted Hugo files before build | |
run: | | |
rm -f themes/*/content/post/* || echo "Failed to remove posts from theme" | |
rm -f themes/*/data/authors/* || echo "Failed to remove authors from theme" | |
rm -rf assets/images/backup || echo "Failed to remove extra images" | |
rm -rf static/images/backup || echo "Failed to remove extra images" | |
- id: hugo_modules | |
name: Download Hugo modules | |
run: | | |
if [[ -f package.json ]]; then | |
echo "Running npm install" | |
npm install | |
fi | |
if [[ -f "go.mod" ]]; then | |
echo "Downloading Go modules" | |
go mod download -x | |
else | |
echo "No go.mod file found" | |
fi | |
echo "Downloading Hugo modules" | |
hugo mod clean | |
hugo mod tidy | |
hugo mod graph | |
# Any branch other than the default is staged for preview. | |
- id: hugo_build_staging | |
name: Build the website using Hugo (Staging) | |
if: env.BRANCH_NAME_CURRENT != env.BRANCH_NAME_DEFAULT | |
env: | |
TZ: "Australia/Sydney" | |
run: | | |
hugo --verbose --gc --minify --cleanDestinationDir --environment staging | |
touch public/.nojekyll | |
ls -la public/ | |
# The default branch is 'Production' | |
- id: hugo_build_production | |
if: env.BRANCH_NAME_CURRENT == env.BRANCH_NAME_DEFAULT | |
name: Build the website using Hugo (Production) | |
env: | |
TZ: "Australia/Sydney" | |
run: | | |
hugo --verbose --gc --minify --cleanDestinationDir --environment production | |
touch public/.nojekyll | |
ls -la public/ | |
- id: publish_worker_staging | |
name: Publish worker using Wrangler (Staging) | |
if: | | |
env.BRANCH_NAME_CURRENT != env.BRANCH_NAME_DEFAULT && | |
steps.hugo_build_staging.outcome == 'success' | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_TOKEN }} | |
environment: staging | |
packageManager: npm | |
command: deploy --env staging --minify | |
workingDirectory: . | |
preCommands: | | |
echo "Running preCommands for staging environment" | |
npm --prefix workers-site install | |
postCommands: | | |
echo "Running postCommands for staging environment" | |
# Only 'trunk' branch is pushed to the Production website | |
- id: publish_worker_production | |
name: Publish worker using Wrangler (Production) | |
if: | | |
env.BRANCH_NAME_CURRENT == env.BRANCH_NAME_DEFAULT && | |
steps.hugo_build_production.outcome == 'success' | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_WORKERS_TOKEN }} | |
environment: production | |
packageManager: npm | |
command: deploy --env production --minify | |
workingDirectory: . | |
preCommands: | | |
echo "Running preCommands for production environment" | |
npm --prefix workers-site install | |
postCommands: | | |
echo "Running postCommands for production environment" | |
################################################## | |
# Giphy thumbs up or down | |
################################################## | |
check: | |
name: PR Status Checks | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu-latest | |
needs: deploy | |
steps: | |
- name: PR Status Giphy | |
id: pr-status-giphy | |
uses: dgteixeira/pr-status-giphy-action@v2 | |
if: github.event_name == 'pull_request' | |
env: | |
GIPHY_API_KEY: ${{ secrets.GIPHY_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |