From 37f431f6b6e7db90d707f20260fb568aa0e70581 Mon Sep 17 00:00:00 2001 From: Taka1304 Date: Sun, 20 Oct 2024 13:00:30 +0900 Subject: [PATCH 1/2] add: vercel deployment ci --- .github/workflows/vercel_dev.yaml | 42 ++++++++++++++++++++++++++++++ .github/workflows/vercel_prod.yaml | 42 ++++++++++++++++++++++++++++++ package.json | 4 +-- 3 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/vercel_dev.yaml create mode 100644 .github/workflows/vercel_prod.yaml diff --git a/.github/workflows/vercel_dev.yaml b/.github/workflows/vercel_dev.yaml new file mode 100644 index 0000000..2f9a97a --- /dev/null +++ b/.github/workflows/vercel_dev.yaml @@ -0,0 +1,42 @@ +name: Deploy to Vercel Dev + +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + +on: + pull_request: + # 手動設定 + workflow_dispatch: + inputs: + ref: + description: branch|tag|SHA to checkout + default: 'main' + required: true +jobs: + deploy: + runs-on: ubuntu-latest + environment: + name: preview + url: ${{ steps.deploy.outputs.url }} + steps: + - uses: actions/checkout@v3 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 20 + check-latest: true + + - name: Install Vercel CLI + run: npm install --global vercel@latest + + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + + - name: Build Project Artifacts + run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + + - name: Deploy Project Artifacts to Vercel + id: deploy + run: echo "url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/.github/workflows/vercel_prod.yaml b/.github/workflows/vercel_prod.yaml new file mode 100644 index 0000000..c8ffabf --- /dev/null +++ b/.github/workflows/vercel_prod.yaml @@ -0,0 +1,42 @@ +name: deploy production + +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + +on: + push: + branches: ['main'] + workflow_dispatch: + inputs: + ref: + description: branch|tag|SHA to checkout + default: 'main' + required: true +jobs: + build: + runs-on: ubuntu-latest + environment: + name: preview + url: ${{ steps.deploy.outputs.url }} + steps: + - uses: actions/checkout@v3 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 20 + check-latest: true + + - name: Install Vercel CLI + run: npm install --global vercel@latest + + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }} + \ No newline at end of file diff --git a/package.json b/package.json index 273adc0..ebbdff3 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,5 @@ "tailwindcss": "^3.4.3", "typescript": "^5.0.2" }, - "volta": { - "node": "20.11.1" - } + "packageManager": "pnpm@9.12.2+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228" } From a0309905f2fad78d178233564cd71804b5cb5173 Mon Sep 17 00:00:00 2001 From: Taka1304 Date: Sun, 20 Oct 2024 13:12:58 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20pnpm=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/vercel_dev.yaml | 2 +- .github/workflows/vercel_prod.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vercel_dev.yaml b/.github/workflows/vercel_dev.yaml index 2f9a97a..1bd19ac 100644 --- a/.github/workflows/vercel_dev.yaml +++ b/.github/workflows/vercel_dev.yaml @@ -29,7 +29,7 @@ jobs: check-latest: true - name: Install Vercel CLI - run: npm install --global vercel@latest + run: npm install --global vercel@latest pnpm@latest - name: Pull Vercel Environment Information run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/vercel_prod.yaml b/.github/workflows/vercel_prod.yaml index c8ffabf..d51a8fa 100644 --- a/.github/workflows/vercel_prod.yaml +++ b/.github/workflows/vercel_prod.yaml @@ -29,7 +29,7 @@ jobs: check-latest: true - name: Install Vercel CLI - run: npm install --global vercel@latest + run: npm install --global vercel@latest pnpm@latest - name: Pull Vercel Environment Information run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}