fix wranglerのenv設定していないとエラーなので消す #58
Workflow file for this run
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: Cloudflare Workersへの自動デプロイ | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [closed] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
name: Deploy | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Publish | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
workingDirectory: . | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
preCommands: | | |
corepack enable | |
pnpm install | |
touch .env | |
echo "NOTION_API_KEY=${{ secrets.NOTION_API_KEY }}" >> .env | |
echo "GHOST_API_URL=${{ secrets.GHOST_API_URL }}" >> .env | |
echo "GHOST_CONTENT_KEY=${{ secrets.GHOST_CONTENT_KEY }}" >> .env | |
# どうやってもできないのでSEDで書き換える↓ | |
cp wrangler.toml.example wrangler.toml | |
sed -i -e "s/ACCOUNT_ID/${{ secrets.CF_ACCOUNT_ID }}/" wrangler.toml | |
sed -i -e "s/KV_ID/${{ secrets.CF_KV_ID }}/" wrangler.toml | |
command: | | |
publish | |
# --config指定しても効かないので注意 | |
# env: | | |
# NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }} | |
# GHOST_API_URL: ${{ secrets.GHOST_API_URL }} | |
# GHOST_CONTENT_KEY: ${{ secrets.GHOST_CONTENT_KEY }} | |
# 参考:https://developers.cloudflare.com/workers/wrangler/ci-cd/ |