well-known-fursona/.build.yml

34 lines
944 B
YAML
Raw Normal View History

image: alpine/edge
2023-05-05 10:55:58 +01:00
secrets:
2023-05-05 11:22:36 +01:00
- ea81f650-6b7e-4cbb-862b-b39195858bfd
2023-05-05 10:55:58 +01:00
- 50b9ba48-c450-43df-a46d-01e2cf0ef9c1
packages:
- nodejs
2023-05-05 11:12:32 +01:00
- npm
2023-05-05 10:55:58 +01:00
sources:
- git@git.sr.ht:~gmem/well-known-fursona
tasks:
- vercel-deploy: |
set +x
export VERCEL_API_TOKEN=$(cat ~/.vercel)
2023-05-05 11:22:22 +01:00
echo "Creating Vercel project"
2023-05-05 10:55:58 +01:00
cd well-known-fursona
mkdir -p .vercel
2023-05-05 11:07:52 +01:00
mv ~/.vercel-well-known-fursona .vercel/project.json
2023-05-05 11:22:22 +01:00
echo "Installing Vercel CLI"
2023-05-05 11:06:25 +01:00
# Install vercel cli
2023-05-05 11:14:46 +01:00
sudo npm i -g vercel
2023-05-05 10:55:58 +01:00
# Get current git branch
2023-05-05 11:22:22 +01:00
echo "Deploying to Vercel"
2023-05-05 11:27:07 +01:00
git fetch origin trunk
2023-05-05 10:55:58 +01:00
# If trunk branch, use --prod, otherwise just deploy
2023-05-05 11:30:10 +01:00
if [ "$(git rev-parse origin/trunk)" = "$(git rev-parse HEAD)" ]; then
2023-05-05 11:22:22 +01:00
echo "Deploying to production"
2023-05-05 11:18:30 +01:00
vercel deploy --prod --token $VERCEL_API_TOKEN
2023-05-05 10:55:58 +01:00
else
2023-05-05 11:22:22 +01:00
echo "Deploying to preview"
2023-05-05 11:18:30 +01:00
vercel deploy --token $VERCEL_API_TOKEN
2023-05-05 10:55:58 +01:00
fi