Skip to content

Commit

Permalink
Update ci.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
void2610 committed Oct 21, 2023
1 parent 93e71e6 commit 7f71301
Showing 1 changed file with 27 additions and 41 deletions.
68 changes: 27 additions & 41 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,60 +7,46 @@ env:
on: push

jobs:
preview:
if: ${{ github.ref != 'refs/heads/main' }}
needs: test
setup:
runs-on: ubuntu-latest
environment:
name: preview
url: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v2
with:
node-version: 18
check-latest: true

- name: Install Vercel CLI
run: npm install --global vercel@latest
node-version: 14

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
test:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: npm install

- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Run tests
run: npm test

- name: Deploy Project Artifacts to Vercel
id: deploy
run: echo "url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT
preview:
if: ${{ github.ref != 'refs/heads/main' }}
needs: [setup, test]
runs-on: ubuntu-latest
environment:
name: preview
url: ${{ steps.deploy.outputs.url }}
steps:
- name: Install Vercel CLI
run: npm install --global vercel

- name: Assign staging domain to deployment (if main branch)
if: ${{ github.ref == 'refs/heads/main' }}
run: vercel alias ${{ steps.deploy.outputs.url }} 2023hp.vercel.app --scope=fitcf-festival-system-team --token=${{ secrets.VERCEL_TOKEN }}
# 以下、他のステップを追加

prod:
if: ${{ github.ref == 'refs/heads/main' }}
needs: test
needs: [setup, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
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 }}
run: npm install --global vercel

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
# 以下、他のステップを追加

0 comments on commit 7f71301

Please sign in to comment.