well-known-fursona/.build.yml

42 lines
1.2 KiB
YAML
Raw Permalink 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
2023-05-07 14:14:43 +01:00
- 921891a4-e0a9-4753-9275-b010d2e2520a
2023-05-05 10:55:58 +01:00
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
2023-05-07 14:14:43 +01:00
environment:
2023-05-07 14:27:54 +01:00
GITHUB_REPO: "gmemstr/well-known-fursona"
2023-05-05 10:55:58 +01:00
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
2023-05-07 14:14:43 +01:00
- mirror-to-github: |
cd well-known-fursona
git remote add github git@github.com:$GITHUB_REPO.git
ssh-keyscan github.com >> ~/.ssh/known_hosts
git push --mirror github