File tree Expand file tree Collapse file tree 1 file changed +28
-4
lines changed
Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Original file line number Diff line number Diff line change 55 workflows : ["Continuous Integration"]
66 types :
77 - completed
8+ branches :
9+ - main
10+
11+ push :
12+ branches :
13+ - main
14+ - feature/** # allow testing
15+ - dev
16+
817 workflow_dispatch :
918
1019jobs :
1120 deploy :
12- if : ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
21+ if : >
22+ github.event_name == 'workflow_dispatch' ||
23+ github.event_name == 'push' ||
24+ (github.event_name == 'workflow_run' &&
25+ github.event.workflow_run.conclusion == 'success')
26+
1327 runs-on : ubuntu-latest
1428
1529 steps :
1630 - name : Checkout code
1731 uses : actions/checkout@v4
1832
19- - name : Get branch name
33+ - name : Determine branch name
2034 id : vars
21- run : echo "branch_name=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
35+ run : |
36+ echo "branch_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
2237
23- - name : Print branch
38+ - name : Log branch being deployed
2439 run : |
2540 echo "🚀 Deploying branch: ${{ steps.vars.outputs.branch_name }}"
2641
42+ - name : Test SSH connection to EC2
43+ 44+ with :
45+ host : ${{ secrets.EC2_HOST }}
46+ username : ubuntu
47+ key : ${{ secrets.EC2_SSH_KEY }}
48+ script : whoami
49+
2750 - name : Deploy to EC2
28512952 with :
3255 key : ${{ secrets.EC2_SSH_KEY }}
3356 script : |
3457 cd /home/ubuntu/sentiment-mlops
58+ echo "Fetching latest code..."
3559 git fetch origin
3660 git checkout ${{ steps.vars.outputs.branch_name }} || git checkout -b ${{ steps.vars.outputs.branch_name }}
3761 git pull origin ${{ steps.vars.outputs.branch_name }}
You can’t perform that action at this time.
0 commit comments