Skip to content

Commit

Permalink
cicd setup
Browse files Browse the repository at this point in the history
  • Loading branch information
para7 committed May 1, 2024
1 parent 38bebd5 commit 1fcc518
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 23 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build
run-name: build check

on:
pull_request:
push:
branches:
- main
- release

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20]
defaults:
run:
working-directory: remix
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
cache-dependency-path: remix
- name: Install dependencies
run: pnpm install --frozen-lockfile

# チェック実行
# - name: vitest
# run: pnpm test:ci
# - name: lint
# run: pnpm lint:ci
- name: build check
run: pnpm build
46 changes: 46 additions & 0 deletions .github/workflows/pages-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: deploy
run-name: deploy to cloudflare

on:
push:
branches:
- main
- release

jobs:
deploy:
runs-on: ubuntu-22.04
permissions:
contents: read
deployments: write
name: Deploy to Cloudflare Pages
defaults:
run:
working-directory: remix
steps:
- name: Checkout
uses: actions/checkout@v3
# setup env
- uses: pnpm/action-setup@v3
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
cache-dependency-path: remix
# builds
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: build
run: pnpm build

- name: Publish
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: portfolio # e.g. 'my-project'
directory: remix/build/client # e.g. 'dist'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ build: util/build remix/node_modules ## run build
docker compose run --rm front_dev /bin/sh -c "pnpm run build"

start: util/build ## start builded server
docker compose run --rm -p 127.0.0.1:3000:3000 front_dev /bin/sh -c "pnpm run start"
docker compose run --rm -p 127.0.0.1:8788:8788 front_dev /bin/sh -c "pnpm run start"


vrt: util/build remix/node_modules ## run visual regression test
Expand Down
2 changes: 1 addition & 1 deletion remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"deploy": "pnpm run build && wrangler pages deploy",
"dev": "remix vite:dev --host 0.0.0.0",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "wrangler pages dev ./build/client",
"start": "wrangler pages dev ./build/client --ip 0.0.0.0",
"ladle": "ladle",
"typecheck": "tsc",
"typegen": "wrangler types",
Expand Down
41 changes: 20 additions & 21 deletions remix/src/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,25 @@ export const meta: MetaFunction = () => {

export default function Index() {
return (
<Shell>
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix (with Vite and Cloudflare)</h1>
<ul>
<li>
<a
target="_blank"
href="https://developers.cloudflare.com/pages/framework-guides/deploy-a-remix-site/"
rel="noreferrer"
>
Cloudflare Pages Docs - Remix guide
</a>
</li>
<li>
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
Remix Docs
</a>
</li>
</ul>
</div>
</Shell>
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix (with Vite and Cloudflare)</h1>
<ul>
<li>
<a
target="_blank"
href="https://developers.cloudflare.com/pages/framework-guides/deploy-a-remix-site/"
rel="noreferrer"
>
Cloudflare Pages Docs - Remix guide
</a>
</li>
<li>
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
Remix Docs
</a>
</li>
<li>cd setup builds</li>
</ul>
</div>
);
}

0 comments on commit 1fcc518

Please sign in to comment.