37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
name: deploy-cloudflare
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch: {}
|
|
|
|
concurrency:
|
|
group: cloudflare-deploy-${{ forgejo.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
deploy:
|
|
# Use Codeberg global hosted runners by label.
|
|
# Available labels in this repo are: codeberg-tiny, codeberg-small, codeberg-medium.
|
|
runs-on: codeberg-medium
|
|
steps:
|
|
- name: Deploy website + worker
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CODEBERG_TOKEN: ${{ secrets.CODEBERG_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ ! -f "./scripts/deploy-workers.sh" ]]; then
|
|
if [[ -z "${CODEBERG_TOKEN:-}" ]]; then
|
|
echo "error: workspace missing repo files and CODEBERG_TOKEN is not set"
|
|
exit 2
|
|
fi
|
|
git clone "https://every-channel:${CODEBERG_TOKEN}@codeberg.org/every-channel/every.channel.git" .repo
|
|
cd .repo
|
|
fi
|
|
if ! command -v nix >/dev/null 2>&1; then
|
|
curl -L https://nixos.org/nix/install | sh -s -- --no-daemon
|
|
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
|
fi
|
|
nix --version
|
|
./scripts/deploy-workers.sh
|