diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e6cadc2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,47 @@ +name: CI & CD +on: + push: + branches: + - '**' +jobs: + Build-and-Deploy: + runs-on: ubuntu-latest + permissions: + contents: write + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 10 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + - name: Install & Build + run: | + pnpm i --frozen-lockfile + pnpm build + + - name: Deploy to GitHub pages + uses: peaceiris/actions-gh-pages@v4 + if: github.ref == 'refs/heads/master' + with: + publish_dir: ./dist + personal_token: ${{ secrets.GITHUB_TOKEN }} + force_orphan: true + + - name: Deploy to Vercel + uses: amondnet/vercel-action@v25 + if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }} + with: + vercel-token: ${{ secrets.VERCEL_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} + vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} + vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} + working-directory: ./ + vercel-args: ${{ github.ref == 'refs/heads/master' && ' --prod' || '' }} \ No newline at end of file