Merge pull request #167 from 0Delta/main #258
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 | |
# デプロイ条件 | |
# 1. main にコミットが追加され、かつ、対象のファイルに変更があるとき | |
# 2. PRのドラフトが解除され、かつ、対象のファイルに変更があるとき | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/deploy.yml' | |
- 'yasunori.toml' | |
- 'packages/api/**' | |
- 'packages/web/**' | |
- 'packages/image-generator/**' | |
pull_request: | |
paths: | |
- '.github/workflows/deploy.yml' | |
- 'yasunori.toml' | |
- 'packages/api/**' | |
- 'packages/web/**' | |
- 'packages/image-generator/**' | |
types: [opened, synchronize, reopened, ready_for_review] | |
jobs: | |
deploy-api: | |
name: Deploy API | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/api | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: | | |
pnpm run generate:json | |
pnpm run build | |
- name: Deploy | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
packageManager: pnpm | |
workingDirectory: packages/api # working-directoryを付けていても必要 | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy | |
deploy-web: | |
name: Deploy Web | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/web | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm run build | |
- name: Deploy | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
packageManager: pnpm | |
workingDirectory: packages/web # working-directoryを付けていても必要 | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy | |
deploy-image-generator: | |
name: Deploy Image Generator | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/image-generator | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm run build | |
- name: Deploy | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
packageManager: pnpm | |
workingDirectory: packages/image-generator # working-directoryを付けていても必要 | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy |