cdn/.gitlab-ci.yml

47 lines
833 B
YAML

---
default:
interruptible: true
tags:
- docker
- linux
stages:
- build
- deploy
workflow:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
SRC_DIR: out
build:site:
stage: build
image: golang:1.21-alpine
before_script:
- echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
- apk add --no-cache templ
- mkdir "$SRC_DIR"
- cp -r src/* "$SRC_DIR"/
script:
- templ generate
- go run . -gen "$SRC_DIR"
artifacts:
expire_in: 1 hour
paths:
- out/
deploy:cloudflare_pages:
stage: deploy
image:
name: node:21-alpine
entrypoint: ['']
script: |
npx wrangler pages deploy \
--project-name=folliehiyuki-cdn \
--branch="$CI_COMMIT_REF_NAME" \
"$SRC_DIR"/
dependencies:
- build:site