From 16c62775d437456bc03ba1968280bce7d69d2d6b Mon Sep 17 00:00:00 2001 From: Dada878 Date: Sun, 2 Feb 2025 18:01:53 +0800 Subject: [PATCH] feat: add Vercel deployment workflow with scheduled JSON generation --- .github/workflows/vercel.yaml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/vercel.yaml diff --git a/.github/workflows/vercel.yaml b/.github/workflows/vercel.yaml new file mode 100644 index 00000000..a325931c --- /dev/null +++ b/.github/workflows/vercel.yaml @@ -0,0 +1,42 @@ +name: Vercel Production Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + push: + branches: + - main +jobs: + Deploy-Production: + if: github.repository_owner == 'Dada878' + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + runs-on: ubuntu-latest + steps: + - run: echo ::set-env name=GHA_OWNER::$(echo $GITHUB_REPOSITORY | awk -F / '{print $1}') + shell: bash + - uses: actions/checkout@v4 + - name: Set timezone to Asia/Taipei + uses: szenius/set-timezone@v1.2 + with: + timezoneLinux: "Asia/Taipei" + timezoneMacos: "Asia/Taipei" + - name: Generate Schedule Json + uses: CCIP-App/schedule-json-generator-action@v2 + with: + gcp-api-key: ${{ secrets.GCP_API_KEY }} + spreadsheet-key: "1AAxHzhqVpmMkUVncgysKPVf6f7lVyvKQMGJZqNJb6aw" + default-avatar: "https://sitcon.org/2022/imgs/deafult_avatar.jpg" + avatar-base-url: "https://sitcon.org/2025/avatar/" + output-path: ./public/sessions.json + - 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 --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} \ No newline at end of file