Skip to content

Commit 743add7

Browse files
committed
fix-deploy
1 parent 89cd2d6 commit 743add7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
name: deploy
55
permissions:
66
contents: read
7-
pull-requests: write
87
on:
98
workflow_dispatch:
109
release:
@@ -37,20 +36,20 @@ jobs:
3736
run: dotnet build --configuration Release --no-restore
3837

3938
- name: Publish
40-
run: dotnet publish src/MvcDemo --configuration Release --runtime linux-x64 --framework net8.0 --output ${{ env.PUBLISH_OUTPUT_DIR }}
39+
run: dotnet publish src/MvcDemo --configuration Release --runtime linux-x64 --output ${{ env.PUBLISH_OUTPUT_DIR }}
4140

4241
- name: Stop the service
4342
uses: appleboy/ssh-action@v1
4443
with:
4544
host: ${{ env.SSH_HOST }}
4645
username: ${{ env.SSH_USERNAME }}
4746
key: ${{ secrets.SSH_PRIVATE_KEY }}
48-
script: |
47+
script: |
48+
# Stop the service (if applicable)
4949
sudo systemctl stop ${{ env.SERVICE_NAME }} || true
5050
5151
- name: Save the SSH private key to a file
5252
run: |
53-
whoami
5453
mkdir -p ~/.ssh
5554
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
5655
chmod 600 ~/.ssh/id_rsa
@@ -64,17 +63,17 @@ jobs:
6463
rsync --version
6564
rsync -avz --exclude 'demo.sqlite' -e "ssh -i ~/.ssh/id_rsa" ${{ env.PUBLISH_OUTPUT_DIR }}/ ${{ env.SSH_USERNAME }}@${{ env.SSH_HOST }}:${{ env.REMOTE_APP_DIR }}/
6665
67-
# Set permissions
68-
sudo chown -R '${{ env.SSH_USERNAME }}':'www-data' ${{ env.REMOTE_APP_DIR }}
69-
sudo chmod -R 775 ${{ env.REMOTE_APP_DIR }}
70-
7166
- name: Start the service
7267
uses: appleboy/ssh-action@v1
7368
with:
7469
host: ${{ env.SSH_HOST }}
7570
username: ${{ env.SSH_USERNAME }}
7671
key: ${{ secrets.SSH_PRIVATE_KEY }}
77-
script: |
72+
script: |
73+
# Set permissions
74+
sudo chown -R '${{ env.SSH_USERNAME }}':'www-data' ${{ env.REMOTE_APP_DIR }}
75+
sudo chmod -R 775 ${{ env.REMOTE_APP_DIR }}
76+
7877
# Restart the service (if applicable)
7978
sudo systemctl start ${{ env.SERVICE_NAME }}
8079

0 commit comments

Comments
 (0)