From 5332d576e958fb7f840edde2bc93affb5445a30c Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Wed, 3 Jun 2026 10:58:15 -0700 Subject: [PATCH 1/2] feat(ci): enhance deploy workflow with manual trigger and branch selection --- .github/workflows/deploy.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d1b7e94a..9859d8a6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,24 +5,37 @@ on: workflows: ["CI"] branches: [main, develop] types: [completed] + workflow_dispatch: + inputs: + ref: + description: Branch to deploy (develop or main) + required: true + type: choice + options: + - develop + - main permissions: contents: read concurrency: - group: deploy-${{ github.event.workflow_run.head_branch }} + group: deploy-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.event.workflow_run.head_branch }} cancel-in-progress: false jobs: deploy: - if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' + if: > + (github.event_name == 'workflow_run' && + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.event == 'push') || + github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest timeout-minutes: 20 - environment: ${{ github.event.workflow_run.head_branch == 'main' && 'production' || (github.event.workflow_run.head_branch == 'develop' && 'staging' || '')}} + environment: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.ref == 'main' || github.event.workflow_run.head_branch == 'main') && 'production' || ((github.event_name == 'workflow_dispatch' && github.event.inputs.ref == 'develop' || github.event.workflow_run.head_branch == 'develop') && 'staging' || '') }} env: - BRANCH: ${{ github.event.workflow_run.head_branch }} + BRANCH: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.event.workflow_run.head_branch }} REPO_URL: https://github.com/${{ github.repository }}.git - SCRIPT_URL: ${{ secrets.DEPLOY_SCRIPT_URL || format('https://raw.githubusercontent.com/{0}/{1}/.github/workflows/deploy-script/deploy.sh', github.repository, github.event.workflow_run.head_sha) }} + SCRIPT_URL: ${{ secrets.DEPLOY_SCRIPT_URL || format('https://raw.githubusercontent.com/{0}/{1}/.github/workflows/deploy-script/deploy.sh', github.repository, github.event_name == 'workflow_dispatch' && github.sha || github.event.workflow_run.head_sha) }} steps: - name: Deploy via SSH uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 From 42ff8281450d94b2317836b45eeb673d95793378 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Wed, 3 Jun 2026 12:40:09 -0700 Subject: [PATCH 2/2] fix(ci): update SCRIPT_URL in deploy workflow to correctly reference branch for manual triggers --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9859d8a6..09ff7205 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,7 +35,7 @@ jobs: env: BRANCH: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.event.workflow_run.head_branch }} REPO_URL: https://github.com/${{ github.repository }}.git - SCRIPT_URL: ${{ secrets.DEPLOY_SCRIPT_URL || format('https://raw.githubusercontent.com/{0}/{1}/.github/workflows/deploy-script/deploy.sh', github.repository, github.event_name == 'workflow_dispatch' && github.sha || github.event.workflow_run.head_sha) }} + SCRIPT_URL: ${{ secrets.DEPLOY_SCRIPT_URL || format('https://raw.githubusercontent.com/{0}/{1}/.github/workflows/deploy-script/deploy.sh', github.repository, github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.event.workflow_run.head_sha) }} steps: - name: Deploy via SSH uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2