Skip to content

Commit

Permalink
👷 Cloudflare Pages へのデプロイとエンジン Strict
Browse files Browse the repository at this point in the history
  • Loading branch information
wappon28dev committed Jun 13, 2024
1 parent fb48a24 commit 62feda2
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: cloudflare

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '[skip ci]') == false

steps:
- name: 📥 Checkout repository
uses: actions/checkout@v3

- name: 📸 Calculate commit hash
id: sha
uses: pr-mpt/actions-commit-hash@v2

- name: 🔨 Prepare Node environment
uses: actions/setup-node@v4
with:
node-version: 22

- name: 🎉 Install project dependencies
run: yarn install

- name: 🏗️ Build app
run: yarn run build

- name: 🚀 Deploy to Cloudflare Pages
id: cloudflare_pages_deploy
uses: cloudflare/pages-action@v1.4.0
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: esachievement
directory: ./dist
env:
NODE_VERSION: 22

- name: 🚀 Deploy pages based on commit sha
uses: actions/github-script@v6
with:
script: |
const sha = context.payload.pull_request?.head.sha ?? context.sha;
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
context: 'cloudflare / build (push)',
description: 'Commit based deploy',
state: 'success',
sha,
target_url: "${{ steps.cloudflare_pages_deploy.outputs.url }}",
});
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"fmt": "prettier --write ./src/",
"lint": "eslint --ext .ts,.tsx ./src"
},
"engines": {
"node": "22"
},
"dependencies": {
"@fontsource-variable/noto-sans-jp": "^5.0.19",
"@generouted/react-router": "^1.19.3",
Expand Down

0 comments on commit 62feda2

Please sign in to comment.