Skip to content

Commit

Permalink
deploy agricoladb-viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur1 committed Mar 9, 2024
1 parent ca07f1d commit 84ee50b
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/on-update-agricoladb-viewer-cloudflare-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: On Update agricoladb-server Cloudflare Pages

on:
push:
branches: [main]
paths:
- components/agricoladb-viewer/cloudflare-pages/**

jobs:
deploy:
uses: ./.github/workflows/wf-deploy-cloudflare-pages.yml
with:
working-directory: ./components/agricoladb-viewer/cloudflare-pages
environment-name: agricoladb-viewer-production
environment-url: https://db.agricolajp.dev/
source-repository: AgricolaDevJP/agricoladb-viewer
build-cmd: build --site https://db.agricolajp.dev
cloudflare-project-name: agricoladb-viewer
secrets: inherit
76 changes: 76 additions & 0 deletions .github/workflows/wf-deploy-cloudflare-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Deploy Cloudflare Pages

on:
workflow_call:
inputs:
working-directory:
required: true
type: string
environment-name:
required: true
type: string
environment-url:
required: true
type: string
source-repository:
required: true
type: string
build-cmd:
required: true
type: string
cloudflare-project-name:
required: true
type: string

permissions:
id-token: write
contents: read

concurrency:
group: ${{ inputs.environment-name }}

jobs:
prepare:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- uses: actions/checkout@v4
- name: Get Target Ref
id: app-ref
run: |
echo "ref=$(cat ref.txt)" >> "$GITHUB_OUTPUT"
outputs:
ref: ${{ steps.app-ref.outputs.ref }}

deploy:
needs: [prepare]
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment-name }}
url: ${{ inputs.environment-url }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.source-repository }}
ref: ${{ needs.prepare.outputs.ref }}
- uses: pnpm/action-setup@v3
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm ${{ inputs.build-cmd }}
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@1
with:
accountId: d8ffa051ff726193056507455bf58eb1
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
projectName: ${{ inputs.cloudflare-project-name }}
directory: dist/
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions components/agricoladb-viewer/cloudflare-pages/ref.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b25d7f8f3162c683815244fa6ff95bd0acefbdfe

0 comments on commit 84ee50b

Please sign in to comment.