blog/.forgejo/workflows/deploy.yml

41 lines
1.3 KiB
YAML
Raw Normal View History

2024-04-29 17:18:42 +00:00
name: Deploy pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2024-04-29 17:20:20 +00:00
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.x"
2024-04-29 17:18:42 +00:00
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
2024-04-29 17:31:56 +00:00
with:
extended: true
- name: Install sass
run: |
export SASS_VERSION=$(curl https://api.github.com/repos/sass/dart-sass/releases | jq -r '. | first |.tag_name | capture("(?<version>[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+)") | .version')
curl -L "https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-linux-arm64.tar.gz" | tar xvz -C /opt/
ln -s /opt/dart-sass/sass /usr/local/bin/
- uses: actions/cache@v4
with:
path: /home/runner/.cache/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-hugomod-
2024-04-29 17:18:42 +00:00
- name: Build
2024-04-29 17:20:20 +00:00
run: |
hugo mod get
hugo --minify --environment production
2024-04-29 17:18:42 +00:00
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_PAGES_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy public --project-name=blog