Skip to content

Commit

Permalink
[CI] Cloudflare Pagesにアップロードするように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
CoreNion committed Jan 17, 2024
1 parent 44a2ed4 commit 11b7646
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 20 deletions.
30 changes: 10 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: every_build

on:
push:
branches: [ main ]
branches: [ main, dev ]
workflow_dispatch:

permissions:
contents: read
pages: write
deployments: write
id-token: write

jobs:
Expand All @@ -31,23 +31,13 @@ jobs:
dart run sqflite_common_ffi_web:setup --force
- name: build pwa
run: flutter build web --base-href "/Leasy/beta/" --output build/web/beta --dart-define=GOOGLE_CLIENT_ID_WEB=${{ secrets.GOOGLE_CLIENT_ID_WEB }} --dart-define=GOOGLE_CLIENT_SECRET_WEB=${{ secrets.GOOGLE_CLIENT_SECRET_WEB }}
run: flutter build web --dart-define=GOOGLE_CLIENT_ID_WEB=${{ secrets.GOOGLE_CLIENT_ID_WEB }} --dart-define=GOOGLE_CLIENT_SECRET_WEB=${{ secrets.GOOGLE_CLIENT_SECRET_WEB }}

- name: upload page artifact
uses: actions/upload-pages-artifact@v2
- name: upload to cloudflare pages
uses: cloudflare/pages-action@v1
with:
path: build/web

deploy_web:
needs: build_web
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v3

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: leasybeta
directory: build/web
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/relesse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish release build

on:
push:
tags:
- v*
workflow_dispatch:

permissions:
contents: read
deployments: write
id-token: write

jobs:
build_web:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
cache: true
cache-key: flutter_linux
cache-path: ${{ runner.tool_cache }}/flutter_linux

- name: Install dependencies
run: |
flutter pub get
dart run sqflite_common_ffi_web:setup --force
- name: build pwa
run: flutter build web --dart-define=GOOGLE_CLIENT_ID_WEB=${{ secrets.GOOGLE_CLIENT_ID_WEB }} --dart-define=GOOGLE_CLIENT_SECRET_WEB=${{ secrets.GOOGLE_CLIENT_SECRET_WEB }}

- name: upload to cloudflare pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: leasyprod
directory: build/web
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 11b7646

Please sign in to comment.