Skip to content

Commit 57f816b

Browse files
authored
Create deploy.yml
1 parent 09d7cfc commit 57f816b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 🚀 Deploy
2+
3+
on:
4+
workflow_dispatch: # Allow manual triggering of the workflow
5+
6+
jobs:
7+
tag_and_redeploy:
8+
runs-on: ubuntu-latest
9+
if: github.event_name == 'workflow_dispatch'
10+
steps:
11+
# Log in to Docker Harbor registry
12+
- name: 🐳 Log in to Harbor Docker registry
13+
run: echo "${{ secrets.HARBOR_PASSWORD }}" | docker login ${{ secrets.HARBOR_URL }} -u '${{ secrets.HARBOR_USERNAME }}' --password-stdin
14+
15+
# Tag the Docker image as latest
16+
- name: 🏷️ Tag Docker image as latest
17+
run: |
18+
docker pull ${{ secrets.HARBOR_URL }}/${{ secrets.IMAGE_NAME }}:${{ github.sha }}
19+
docker tag ${{ secrets.HARBOR_URL }}/${{ secrets.IMAGE_NAME }}:${{ github.sha }} ${{ secrets.HARBOR_URL }}/${{ secrets.IMAGE_NAME }}:latest
20+
docker push ${{ secrets.HARBOR_URL }}/${{ secrets.IMAGE_NAME }}:latest
21+
- name: ⏳ Wait for the new tag to refresh
22+
run: sleep 10s
23+
shell: bash
24+
# Call the webhook for redeploying the application
25+
- name: 🔄 Call redeploy webhook
26+
run: |
27+
curl -X POST -H "Content-Type: application/json" \
28+
-d '{"tag": "latest"}' \
29+
${{ secrets.REDEPLOY_WEBHOOK_URL }}

0 commit comments

Comments
 (0)