From ae35a4ca1aaf7a9ca9a010999f2a34cecd65aaa9 Mon Sep 17 00:00:00 2001 From: CritasWang Date: Mon, 12 Jan 2026 18:25:19 +0800 Subject: [PATCH] change deploy to ssh --- .github/workflows/clean-site.yml | 24 ++++++++++++++++++------ .github/workflows/site-build.yaml | 14 ++++++++++---- deploy.cjs | 2 +- deploy_staging.cjs | 4 ++-- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/.github/workflows/clean-site.yml b/.github/workflows/clean-site.yml index cf3b8b4ed..61aba6079 100644 --- a/.github/workflows/clean-site.yml +++ b/.github/workflows/clean-site.yml @@ -28,13 +28,25 @@ jobs: echo "❌ Cleanup cancelled: confirmation not provided" exit 1 + - name: Setup SSH + env: + SSH_KEY: ${{ secrets.IOTDB_WEBSITE_BUILD_SSH }} + run: | + mkdir -p ~/.ssh + echo "$SSH_KEY" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H github.com >> ~/.ssh/known_hosts + - name: Checkout iotdb-website repository - uses: actions/checkout@v4 - with: - repository: apache/iotdb-website - token: ${{ secrets.IOTDB_WEBSITE_BUILD }} - fetch-depth: 0 - ref: ${{ github.event.inputs.target_branch == 'both' && 'asf-site' || github.event.inputs.target_branch }} + run: | + git clone --bare git@github.com:apache/iotdb-website.git + cd iotdb-website.git + for branch in asf-site asf-staging; do + git branch -r | grep $branch > /dev/null && echo "Branch $branch exists" + done + cd .. + git clone git@github.com:apache/iotdb-website.git + cd iotdb-website - name: Configure Git run: | diff --git a/.github/workflows/site-build.yaml b/.github/workflows/site-build.yaml index 688deab60..2a68c963e 100644 --- a/.github/workflows/site-build.yaml +++ b/.github/workflows/site-build.yaml @@ -40,9 +40,12 @@ jobs: - name: Deploy staging website env: - IOTDB_WEBSITE_BUILD: ${{ secrets.IOTDB_WEBSITE_BUILD }} + SSH_KEY: ${{ secrets.IOTDB_WEBSITE_BUILD_SSH }} run: | - git config --global url."https://asf-ci-deploy:$IOTDB_WEBSITE_BUILD@github.com/apache/".insteadOf "https://github.com/apache/" + mkdir -p ~/.ssh + echo "$SSH_KEY" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H github.com >> ~/.ssh/known_hosts git config --global user.name github-actions git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com npm run deploy:staging @@ -97,9 +100,12 @@ jobs: - name: Deploy website env: - IOTDB_WEBSITE_BUILD: ${{ secrets.IOTDB_WEBSITE_BUILD }} + SSH_KEY: ${{ secrets.IOTDB_WEBSITE_BUILD_SSH }} run: | - git config --global url."https://asf-ci-deploy:$IOTDB_WEBSITE_BUILD@github.com/apache/".insteadOf "https://github.com/apache/" + mkdir -p ~/.ssh + echo "$SSH_KEY" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H github.com >> ~/.ssh/known_hosts git config --global user.name github-actions git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com npm run deploy diff --git a/deploy.cjs b/deploy.cjs index 44786a254..80ec2a1f1 100644 --- a/deploy.cjs +++ b/deploy.cjs @@ -22,7 +22,7 @@ ghpages.publish( 'src/.vuepress/dist', { branch: 'asf-site', - repo: 'https://github.com/apache/iotdb-website.git', + repo: 'git@github.com:apache/iotdb-website.git', message: 'Site checkin for project iotdb-website', dotfiles: true, history: false, diff --git a/deploy_staging.cjs b/deploy_staging.cjs index 15a0a6f5a..8551e0bff 100644 --- a/deploy_staging.cjs +++ b/deploy_staging.cjs @@ -22,8 +22,8 @@ ghpages.publish( 'src/.vuepress/dist', { branch: 'asf-staging', - repo: 'https://github.com/apache/iotdb-website.git', - message: 'Site checkin for project iotdb-website', + repo: 'git@github.com:apache/iotdb-website.git', + message: 'Site staging checkin for project iotdb-website', dotfiles: true, history: false, },