Skip to content

Commit 08d091b

Browse files
committed
add workflows
1 parent b661056 commit 08d091b

File tree

3 files changed

+73
-31
lines changed

3 files changed

+73
-31
lines changed

.github/workflows/preview.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Vercel Preview Deployment
2+
env:
3+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
5+
on:
6+
push:
7+
branches-ignore:
8+
- main
9+
jobs:
10+
Deploy-Preview:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Install Vercel CLI
15+
run: npm install --global vercel@latest
16+
- name: Pull Vercel Environment Information
17+
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
18+
- name: Build Project Artifacts
19+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
20+
- name: Deploy Project Artifacts to Vercel
21+
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

.github/workflows/production.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Vercel Production Deployment
2+
env:
3+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
5+
on:
6+
push:
7+
branches:
8+
- main
9+
jobs:
10+
Deploy-Production:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Install Vercel CLI
15+
run: npm install --global vercel@latest
16+
- name: Pull Vercel Environment Information
17+
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
18+
- name: Build Project Artifacts
19+
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
20+
- name: Deploy Project Artifacts to Vercel
21+
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-
22

33
## Getting Started
44

5-
First, run the development server:
6-
7-
```bash
8-
npm run dev
9-
# or
10-
yarn dev
11-
# or
12-
pnpm dev
13-
# or
14-
bun dev
5+
* gitリポジトリをつくります
6+
```sh
7+
npx create-next-app@latest
158
```
16-
17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18-
19-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20-
21-
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22-
23-
## Learn More
24-
25-
To learn more about Next.js, take a look at the following resources:
26-
27-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29-
30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31-
32-
## Deploy on Vercel
33-
34-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35-
36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
9+
* GitHubにpushします
10+
* Vercelにプロジェクトを作ります。ただし、VercelのUIからではなく次のようにコマンドからやります。
11+
```sh
12+
npx vercel deploy
13+
```
14+
```
15+
Vercel CLI 41.1.4
16+
? Set up and deploy “~/projects/vercel-example”? yes
17+
? Which scope should contain your project? natrium144's projects
18+
? Link to existing project? no
19+
? What’s your project’s name? vercel-example
20+
? In which directory is your code located? ./
21+
Local settings detected in vercel.json:
22+
Auto-detected Project Settings (Next.js):
23+
- Build Command: next build
24+
- Development Command: next dev --port $PORT
25+
- Install Command: `yarn install`, `pnpm install`, `npm install`, or `bun install`
26+
- Output Directory: Next.js default
27+
? Want to modify these settings? no
28+
🔗 Linked to natrium144s-projects/vercel-example (created .vercel)
29+
```
30+
* Vercel の Account Settings → Tokens へ行き、Tokenを作成します
31+
* GitHubでリポジトリの Settings → Secrets and variables → Actions へ行き、 Repository Secrets に以下を追加しましょう
32+
* `VERCEL_TOKEN`: 先ほど作成したToken
33+
* `VERCEL_ORG_ID`: .vercel/project.json 内にある `orgId`
34+
* `VERCEL_PROJECT_ID`: .vercel/project.json 内にある `projectId`
35+
* [GitHub ActionのWorkflowファイル](.github/workflows)を作成し、pushします。([これ](https://vercel.com/guides/how-can-i-use-github-actions-with-vercel)のコピペですが)
36+
* main以外のブランチに変更がpushされるとpreviewとしてデプロイされ、mainに変更がpushされるとproductionとしてデプロイされます

0 commit comments

Comments
 (0)