Skip to content

Commit 1e2c5b3

Browse files
[TASK] Deployment
1 parent d661257 commit 1e2c5b3

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

.github/workflows/docshome.yml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,11 @@ jobs:
1616
- name: Checkout
1717
uses: actions/checkout@v4
1818

19-
# - name: Setup SSH
20-
# uses: ./.github/actions/setup-ssh
21-
# with:
22-
# ssh-key: ${{ secrets.DEPLOY_KEY }}
23-
# remote: ${{ secrets.DEPLOY_DOCS_HOST }}
24-
25-
- name: Setup SSH key
26-
shell: bash
27-
env:
28-
SSH_AUTH_SOCK: /tmp/ssh-auth.sock
29-
run: |
30-
set -x
31-
mkdir -p ~/.ssh
32-
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
33-
chmod 0600 ~/.ssh/id_ed25519
34-
ssh-keyscan ${{ secrets.DEPLOY_DOCS_HOST }} >> ~/.ssh/known_hosts
35-
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
36-
ssh-add ~/.ssh/id_ed25519
19+
- name: Setup SSH
20+
uses: ./.github/actions/setup-ssh
21+
with:
22+
ssh-key: ${{ secrets.DEPLOY_KEY }}
23+
remote: ${{ secrets.DEPLOY_DOCS_HOST }}
3724

3825
- name: Create artifact archive
3926
run: |
@@ -42,7 +29,12 @@ jobs:
4229
4330
- name: Copy artifact to server
4431
run: |
45-
scp -vvvv WebRootResources.tar.gz ${{ secrets.DEPLOY_DOCS_USERNAME }}@${{ secrets.DEPLOY_DOCS_HOST }}:${{ secrets.TARGET_PATH }}
32+
scp WebRootResources.tar.gz ${{ secrets.DEPLOY_DOCS_USERNAME }}@${{ secrets.DEPLOY_DOCS_HOST }}:${{ secrets.TMP_TARGET_PATH }}
33+
34+
- name: Extract artifact on server
35+
run: |
36+
CURRENT_DATE=$(date +%Y%m%d%H%M%S)
37+
ssh ${{ secrets.DEPLOY_DOCS_USERNAME }}@${{ secrets.DEPLOY_DOCS_HOST }} 'mv ${{ secrets.TARGET_PATH }} ${{ secrets.TARGET_PATH }}.${CURRENT_DATE} && mkdir ${{ secrets.TARGET_PATH }} && tar xfvz ${{ secrets.TMP_TARGET_PATH }}/WebRootResources.tar.gz ${{ secrets.TARGET_PATH }}'
4638
4739
# - name: SCP files to production system
4840
# uses: appleboy/scp-action@master

0 commit comments

Comments
 (0)