This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (83 loc) · 3.38 KB
/
ci.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: CI/CD
on:
release:
types: [published]
jobs:
test:
name: Unittest
uses: ./.github/workflows/php.yaml
deploy_hetzner:
name: Deploy (Hetzner)
runs-on: ubuntu-latest
concurrency:
group: deploy-${{github.ref}}
cancel-in-progress: false
needs:
- test
environment:
name: hetzner
url: https://hirsch.hochwarth-e.com/
steps:
- name: Get the version
id: get_version
run: |
echo VERSION=${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT
echo '# Build status' >> $GITHUB_STEP_SUMMARY
- uses: actions/checkout@v4
with:
submodules: 'recursive'
ssh-key: '${{ secrets.SSHKEY }}'
lfs: true
- name: Set Timezone
uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Berlin"
- uses: shivammathur/[email protected]
with:
php-version: 8.3
tools: composer:v2
extensions: intl, mbstring, imap, zip, dom, pdo_mysql
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Make Install
env:
DBPASS: ${{ secrets.DBPASS }}
SALT: ${{ secrets.SALT }}
EMAILPASS: ${{ secrets.EMAILPASS }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
run: make all
- name: Add Feature Flags to .env.local
env:
FEATURE_FLAGS: ${{ vars.FEATURE_FLAGS }}
run: |
echo FEATURE_FLAGS=${FEATURE_FLAGS} >> .env.local
- run: sudo apt-get install -y sshpass rsync
name: 📦 Installing upload dependencies
- run: sshpass -p '${{ secrets.PASSWORD }}' rsync --exclude ".git" --exclude ".gitmodules" --exclude ".gitattributes" --exclude ".ddev" --exclude "docker*" --exclude "infection.json.dist" --exclude "config/secrets/prod/prod.decrypt.private.php" --exclude ".editorconfig" -e "ssh -o StrictHostKeyChecking=no -p 222" -avh --delete --force ./ ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/usr/home/${{ secrets.USERNAME }}/public_html/hirsch
id: upload
name: 👨💻 Uploading files
- run: sshpass -p '${{ secrets.PASSWORD }}' ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} -p 222 -f "cd /usr/home/${{ secrets.USERNAME }}/public_html/hirsch && /usr/bin/php82 bin/console --no-interaction doctrine:migrations:migrate && /usr/bin/php82 bin/console --no-interaction cache:clear && /usr/bin/php82 bin/console --no-interaction cache:warmup && APP_RUNTIME_ENV=prod /usr/bin/php82 bin/console secrets:decrypt-to-local --force"
id: preperations
name: 👨💻 Preparing system
- run: echo "Deployment finished at $(date +'%d.%m.%Y %H:%M:%S %Z')" >> $GITHUB_STEP_SUMMARY
remove_on_failed:
name: Remove Release on fails
runs-on: ubuntu-latest
needs:
- test
if: ${{ failure() }}
steps:
- name: Set output
id: vars
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
- uses: dev-drprasad/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: true # default: false
tag_name: ${{ steps.vars.outputs.tag }} # tag name to delete