Move to Vercel
This commit is contained in:
@ -1,53 +1,32 @@
|
||||
# Exclude the pipeline to run on the pages branch
|
||||
when:
|
||||
branch:
|
||||
exclude: pages
|
||||
# Taken from https://www.markpitblado.me/blog/deploying-to-vercel-from-codeberg
|
||||
|
||||
steps:
|
||||
# Check for typos
|
||||
typos:
|
||||
image: alpine:edge
|
||||
preview:
|
||||
image: node
|
||||
environment:
|
||||
VERCEL_TOKEN:
|
||||
from_secret: vercel_token
|
||||
VERCEL_ORG_ID:
|
||||
from_secret: vercel_org_id
|
||||
VERCEL_PROJECT_ID:
|
||||
from_secret: vercel_project_id
|
||||
commands:
|
||||
- apk add curl jq
|
||||
- curl -s "https://api.github.com/repos/crate-ci/typos/releases/latest" | jq -r '.assets[] | select(.name | contains("unknown-linux-musl")) | .browser_download_url' | xargs -n 1 curl -L -o typos.tar.gz
|
||||
- tar -zxvf typos.tar.gz ./typos
|
||||
- ./typos
|
||||
failure: ignore
|
||||
- npm install --global vercel@latest
|
||||
- vercel deploy --token=$VERCEL_TOKEN
|
||||
when:
|
||||
event: [push, pull_request, manual]
|
||||
event: [pull_request]
|
||||
|
||||
# Build Zola static files
|
||||
build:
|
||||
image: alpine:edge
|
||||
deploy:
|
||||
image: node
|
||||
environment:
|
||||
VERCEL_TOKEN:
|
||||
from_secret: vercel_token
|
||||
VERCEL_ORG_ID:
|
||||
from_secret: vercel_org_id
|
||||
VERCEL_PROJECT_ID:
|
||||
from_secret: vercel_project_id
|
||||
commands:
|
||||
- apk add zola
|
||||
- zola build
|
||||
when:
|
||||
event: [push, pull_request, manual]
|
||||
|
||||
publish:
|
||||
image: bitnami/git
|
||||
# Must be set in Woodpecker configuration
|
||||
# mail: Your email address used by Codeberg
|
||||
# codeberg_token: Codeberg access token with "write:repository" permission
|
||||
secrets: [mail, codeberg_token]
|
||||
commands:
|
||||
# Configure Git
|
||||
- git config --global user.email $MAIL
|
||||
- git config --global user.name "Woodpecker CI"
|
||||
# Clone the output branch
|
||||
- git clone --branch pages https://$CODEBERG_TOKEN@codeberg.org/$CI_REPO.git $CI_REPO_NAME
|
||||
# Enter the output branch
|
||||
- cd $CI_REPO_NAME
|
||||
# Remove old files
|
||||
- git rm -r "*" || true # Don't fail if there's nothing to remove
|
||||
# Copy the output of the build step
|
||||
- cp -ar ../public/. .
|
||||
# Copy .domains in place (Duckquill specific. you should just place it in ./static/)
|
||||
- cp ../.domains .
|
||||
# Commit and push all static files with the source commit hash
|
||||
- git add --all
|
||||
- git commit -m "Woodpecker CI ${CI_COMMIT_SHA} [SKIP CI]" --allow-empty
|
||||
- git push
|
||||
- npm install --global vercel@latest
|
||||
- vercel deploy --prod --token=$VERCEL_TOKEN
|
||||
when:
|
||||
event: [push, manual]
|
||||
|
Reference in New Issue
Block a user