From b4699e4837db2dd17886ea2732a64a95f9578cd6 Mon Sep 17 00:00:00 2001 From: daudix Date: Tue, 3 Dec 2024 01:27:49 +0300 Subject: [PATCH] Move to Vercel --- .domains | 2 -- .gitignore | 1 + .woodpecker.yaml | 69 +++++++++++++++++------------------------------- 3 files changed, 25 insertions(+), 47 deletions(-) delete mode 100644 .domains diff --git a/.domains b/.domains deleted file mode 100644 index 95bdcf5..0000000 --- a/.domains +++ /dev/null @@ -1,2 +0,0 @@ -duckquill.daudix.one -duckquill.daudix.codeberg.page diff --git a/.gitignore b/.gitignore index 364fdec..7af4e43 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ public/ +.vercel diff --git a/.woodpecker.yaml b/.woodpecker.yaml index 6db6a97..05656fc 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -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]