-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (55 loc) · 1.65 KB
/
deploy_bot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Deploy Bot
on:
push:
branches:
- master
paths:
- packages/image-search-bot/src/**
- packages/image-search-bot/package.json
- packages/image-search-bot/wrangler.json
jobs:
check-token:
runs-on: ubuntu-latest
environment: production
outputs:
is_set: ${{ steps.check.outputs.is_set }}
steps:
- name: Check for Cloudflare API token
id: check
run: |
if [[ '${{ secrets.CLOUDFLARE_API_TOKEN }}' ]]; then
echo "is_set=true" >> "$GITHUB_OUTPUT"
else
echo "is_set=false" >> "$GITHUB_OUTPUT"
echo "Cloudflare API token is not set. Skipping deployment."
fi
check-package:
name: Check package
needs: check-token
if: ${{ needs.check-token.outputs.is_set == 'true' }}
uses: ./.github/workflows/check.yml
secrets: inherit
with:
cwd: packages/image-search-bot
deploy:
runs-on: ubuntu-latest
needs: check-package
environment: production
defaults:
run:
working-directory: packages/image-search-bot
steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup Bun
uses: oven-sh/setup-bun@f4d14e03ff726c06358e5557344e1da148b56cf7
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: lts/*
- name: Install dependencies
run: bun install --frozen-lockfile --production
- name: Build & Deploy
run: bun run deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}