-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (62 loc) · 2.58 KB
/
ci-cd.yml
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
name: CI + CD
on:
push:
pull_request:
workflow_dispatch:
jobs:
get-environment-name:
name: "Extract environment name"
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.extract.outputs.environment }}
steps:
- id: extract
run: echo "environment=$(echo $GITHUB_REF | sed -e '/^refs\/heads\/deploy-\(.*\)$/!d;s//\1/')" >> $GITHUB_OUTPUT
- env:
EXTRACTED: ${{ steps.extract.outputs.environment }}
run: 'echo "Extracted environment name: $EXTRACTED"'
deploy:
name: "Deploy"
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && needs.get-environment-name.outputs.environment }}
needs:
- get-environment-name
environment: ${{ needs.get-environment-name.outputs.environment }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update -y && sudo apt-get install -y lftp
- uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ vars.SSH_KNOWN_HOSTS }}
- run: sudo apt-get update -y && sudo apt-get install -y lftp
- uses: ./.github/actions/deploy
with:
ssh-username: ${{ secrets.SSH_USERNAME }}
ssh-host: ${{ vars.SSH_HOST }}
ssh-backend-directory: ${{ vars.SSH_BACKEND_DIRECTORY }}
ssh-frontend-directory: ${{ vars.SSH_FRONTEND_DIRECTORY }}
app-name: ${{ vars.APP_NAME }}
app-key: ${{ secrets.APP_KEY }}
backend-url: ${{ vars.BACKEND_URL }}
frontend-url: ${{ vars.FRONTEND_URL }}
db-host: ${{ secrets.DB_HOST }}
db-database: ${{ secrets.DB_DATABASE }}
db-username: ${{ secrets.DB_USERNAME }}
db-password: ${{ secrets.DB_PASSWORD }}
midata-base-url: ${{ vars.MIDATA_BASE_URL }}
midata-client-uid: ${{ vars.MIDATA_CLIENT_UID }}
midata-client-secret: ${{ secrets.MIDATA_CLIENT_SECRET }}
seed-db: ${{ vars.SEED_DB }}
midata-id: ${{ vars.MIDATA_ID }}
ssh-port: ${{ vars.SSH_PORT }}
mail-username: ${{ secrets.MAIL_USERNAME }}
mail-password: ${{ secrets.MAIL_PASSWORD }}
mail-mailer: ${{ vars.MAIL_MAILER }}
mail-host: ${{ vars.MAIL_HOST }}
mail-port: ${{ vars.MAIL_PORT }}
mail-encryption: ${{ vars.MAIL_ENCRYPTION }}
mail-from-address: ${{ vars.MAIL_FROM_ADDRESS }}
mail-from-name: ${{ vars.MAIL_FROM_NAME }}
deployment-secret-key: ${{ secrets.DEPLOYMENT_SECRET_KEY }}
php-path: ${{ vars.PHP_PATH }}