Skip to content

Commit

Permalink
switch to cloudflare pages (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
cswimr authored Dec 16, 2024
1 parent 0409732 commit acade0c
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 61 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/hugo-build.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
name: build
name: Build
on:
push:
branches: ["main"]
workflow_call:
inputs:
production:
type: boolean
default: true

jobs:
build:
name: Build Site
runs-on: ubuntu-latest
steps:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "0.139.4"
extended: true
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "0.139.4"
extended: true
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
Expand All @@ -39,12 +40,11 @@ jobs:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
run: |
hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
hugo --minify --baseURL "https://v2.galaxypedia.org"
- name: Build Pagefind index
run: pnpm pagefind
- name: Check for broken external links
run: echo "THIS IS BREAKING CI PLEASES NO"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: pages-build
path: ./public
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy
on:
workflow_run:
workflows: ["Build", "Pull Request"]
types: [completed]

permissions:
actions: read
contents: read
pull-requests: write
deployments: write

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
id: build-artifact
with:
name: pages-build
path: build
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Deploy to Cloudflare Pages
uses: AdrianGonz97/refined-cf-pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: galaxypedia
deploymentName: ${{ github.event.workflow_run.name == 'Pull Request' && 'Preview' || 'Production' }}
directory: ${{ steps.build-artifact.outputs.download-path }}
45 changes: 0 additions & 45 deletions .github/workflows/hugo-deploy.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: Pull Request Validator
name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
uses: ./.github/workflows/hugo-build.yml
name: Build Preview Deployment
uses: ./.github/workflows/build.yml
with:
production: false

check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down

0 comments on commit acade0c

Please sign in to comment.