feat: initial commit #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |