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