Skip to content

Commit c86e032

Browse files
authored
change deploy to ssh (#963)
1 parent 593a139 commit c86e032

File tree

4 files changed

+31
-13
lines changed

4 files changed

+31
-13
lines changed

.github/workflows/clean-site.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,25 @@ jobs:
2828
echo "❌ Cleanup cancelled: confirmation not provided"
2929
exit 1
3030
31+
- name: Setup SSH
32+
env:
33+
SSH_KEY: ${{ secrets.IOTDB_WEBSITE_BUILD_SSH }}
34+
run: |
35+
mkdir -p ~/.ssh
36+
echo "$SSH_KEY" > ~/.ssh/id_rsa
37+
chmod 600 ~/.ssh/id_rsa
38+
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
39+
3140
- name: Checkout iotdb-website repository
32-
uses: actions/checkout@v4
33-
with:
34-
repository: apache/iotdb-website
35-
token: ${{ secrets.IOTDB_WEBSITE_BUILD }}
36-
fetch-depth: 0
37-
ref: ${{ github.event.inputs.target_branch == 'both' && 'asf-site' || github.event.inputs.target_branch }}
41+
run: |
42+
git clone --bare [email protected]:apache/iotdb-website.git
43+
cd iotdb-website.git
44+
for branch in asf-site asf-staging; do
45+
git branch -r | grep $branch > /dev/null && echo "Branch $branch exists"
46+
done
47+
cd ..
48+
git clone [email protected]:apache/iotdb-website.git
49+
cd iotdb-website
3850
3951
- name: Configure Git
4052
run: |

.github/workflows/site-build.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ jobs:
4040

4141
- name: Deploy staging website
4242
env:
43-
IOTDB_WEBSITE_BUILD: ${{ secrets.IOTDB_WEBSITE_BUILD }}
43+
SSH_KEY: ${{ secrets.IOTDB_WEBSITE_BUILD_SSH }}
4444
run: |
45-
git config --global url."https://asf-ci-deploy:[email protected]/apache/".insteadOf "https://github.com/apache/"
45+
mkdir -p ~/.ssh
46+
echo "$SSH_KEY" > ~/.ssh/id_rsa
47+
chmod 600 ~/.ssh/id_rsa
48+
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
4649
git config --global user.name github-actions
4750
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
4851
npm run deploy:staging
@@ -97,9 +100,12 @@ jobs:
97100

98101
- name: Deploy website
99102
env:
100-
IOTDB_WEBSITE_BUILD: ${{ secrets.IOTDB_WEBSITE_BUILD }}
103+
SSH_KEY: ${{ secrets.IOTDB_WEBSITE_BUILD_SSH }}
101104
run: |
102-
git config --global url."https://asf-ci-deploy:[email protected]/apache/".insteadOf "https://github.com/apache/"
105+
mkdir -p ~/.ssh
106+
echo "$SSH_KEY" > ~/.ssh/id_rsa
107+
chmod 600 ~/.ssh/id_rsa
108+
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
103109
git config --global user.name github-actions
104110
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
105111
npm run deploy

deploy.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ghpages.publish(
2222
'src/.vuepress/dist',
2323
{
2424
branch: 'asf-site',
25-
repo: 'https://github.com/apache/iotdb-website.git',
25+
repo: 'git@github.com:apache/iotdb-website.git',
2626
message: 'Site checkin for project iotdb-website',
2727
dotfiles: true,
2828
history: false,

deploy_staging.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ ghpages.publish(
2222
'src/.vuepress/dist',
2323
{
2424
branch: 'asf-staging',
25-
repo: 'https://github.com/apache/iotdb-website.git',
26-
message: 'Site checkin for project iotdb-website',
25+
repo: 'git@github.com:apache/iotdb-website.git',
26+
message: 'Site staging checkin for project iotdb-website',
2727
dotfiles: true,
2828
history: false,
2929
},

0 commit comments

Comments
 (0)