Skip to content

Commit 35596ed

Browse files
Merge pull request #60 from christianncode/feat/AddWorkflowAzureVM
add deploy ways
2 parents 7593c1b + 05ee621 commit 35596ed

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

.github/scripts/deploy.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
112
ssh -o StrictHostKeyChecking=no azureuser@40.82.162.21 <<HTML
213
3-
cd /home/azureuser/learning-github-actions
4-
git pull origin main
14+
cd $PWD_PATH
15+
git pull origin $BRANCH_NAME
516
617
HTML

.github/workflows/workflow-azure-vm.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ jobs:
2020
ssh -o StrictHostKeyChecking=no azureuser@40.82.162.21 touch hello.txt
2121
2222
- name: "Run deploy script on Azure VM"
23-
run: bash .github/scripts/deploy.sh
23+
if: ${{ github.ref == 'refs/heads/main' }}
24+
run: bash .github/scripts/deploy.sh main

0 commit comments

Comments
 (0)