-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (69 loc) · 2.23 KB
/
Copy pathdeploy.yml
File metadata and controls
79 lines (69 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Deploy
on:
push:
branches: [ main ]
tags:
- 'v*'
workflow_dispatch:
jobs:
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: staging
url: https://staging.example.com
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to staging server
run: |
echo "Deploying to staging environment"
# Add your deployment commands here
# Example: ssh user@staging-server "cd /app && git pull && docker-compose up -d"
# Uncomment and configure for actual deployment
# - name: SSH Deploy
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.STAGING_HOST }}
# username: ${{ secrets.STAGING_USER }}
# key: ${{ secrets.STAGING_SSH_KEY }}
# script: |
# cd /path/to/app
# git pull origin main
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: production
url: https://example.com
needs: []
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to production server
run: |
echo "Deploying version ${{ github.ref_name }} to production"
# Add your deployment commands here
# Uncomment and configure for actual deployment
# - name: SSH Deploy
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.PRODUCTION_HOST }}
# username: ${{ secrets.PRODUCTION_USER }}
# key: ${{ secrets.PRODUCTION_SSH_KEY }}
# script: |
# cd /path/to/app
# git fetch --tags
# git checkout ${{ github.ref_name }}
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml pull
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
generate_release_notes: true
draft: false
prerelease: false