Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

2024.10.19

2024.10.19 #677

Workflow file for this run

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/set-timezone@v2.0
with:
timezoneLinux: "Europe/Berlin"
- uses: shivammathur/setup-php@2.31.1
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/delete-tag-and-release@v1.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: true # default: false
tag_name: ${{ steps.vars.outputs.tag }} # tag name to delete