Skip to content

Merge pull request #477 from mloberg/fix/image-class-tailwind #10

Merge pull request #477 from mloberg/fix/image-class-tailwind

Merge pull request #477 from mloberg/fix/image-class-tailwind #10

Workflow file for this run

name: Publish
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: config
id: config
run: |
name=$(basename "${{ github.head_ref || github.ref }}")
echo "name=$name" >> "$GITHUB_OUTPUT"
if [ "$name" != "main" ]; then
echo "hugo=--baseURL \"https://${name}.mloberg.pages.dev\"" >> "$GITHUB_OUTPUT"
echo "wrangler=--branch=${name}" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v4
with:
fetch-depth: 0 # for .GitInfo and .Lastmod
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: npm
- run: npm ci
- run: npm run lint
if: github.event_name == 'pull_request'
- uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.141.0'
extended: true
- run: hugo build --gc --minify ${{ steps.config.outputs.hugo }}
- uses: actions/upload-artifact@v4
with:
name: site
path: public/
- uses: anishathalye/proof-html@v2
if: github.event_name == 'pull_request'
with:
directory: ./public
swap_urls: |
{"^https:\\/\\/mlo\\.io\\/": "/", "^https:\\/\\/.*\\.pages\\.dev\\/": "/"}
outputs:
wrangler: ${{ steps.config.outputs.wrangler }}
deploy:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
deployments: write
steps:
- uses: actions/download-artifact@v4
with:
name: site
path: public
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
command: pages deploy public --project-name=mloberg ${{ needs.build.outputs.wrangler }}