There was an error while loading. Please reload this page.
2 parents 7593c1b + 05ee621 commit 35596edCopy full SHA for 35596ed
2 files changed
.github/scripts/deploy.sh
@@ -1,6 +1,17 @@
1
+BRANCH_NAME=$1
2
+
3
+if [ "$BRANCH_NAME" == "main" ]; then
4
+ PWD_PATH="/home/azureuser/learning-github-actions"
5
+if [ "$BRANCH_NAME" == "certi" ]; then
6
+ PWD_PATH="/home/azureuser/certi"
7
+else
8
+ PWD_PATH="/home/azureuser/develop"
9
+fi
10
11
12
ssh -o StrictHostKeyChecking=no azureuser@40.82.162.21 <<HTML
13
- cd /home/azureuser/learning-github-actions
- git pull origin main
14
+ cd $PWD_PATH
15
+ git pull origin $BRANCH_NAME
16
17
HTML
.github/workflows/workflow-azure-vm.yml
@@ -20,4 +20,5 @@ jobs:
20
ssh -o StrictHostKeyChecking=no azureuser@40.82.162.21 touch hello.txt
21
22
- name: "Run deploy script on Azure VM"
23
- run: bash .github/scripts/deploy.sh
+ if: ${{ github.ref == 'refs/heads/main' }}
24
+ run: bash .github/scripts/deploy.sh main
0 commit comments