feat: renaming, add pipeline
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: typo3-basic
|
||||
name: lena-schilling
|
||||
type: typo3
|
||||
docroot: public
|
||||
php_version: "8.3"
|
||||
|
||||
37
.gitea/workflows/build.yaml
Normal file
37
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
PHP_VERSION: '8.3' # set this to the PHP version to use
|
||||
COMPOSER_ALLOW_SUPERUSER: 1
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@7c0b4c8c8ebed23eca9ec2802474895d105b11bc
|
||||
with:
|
||||
php-version: ${{ env.PHP_VERSION }}
|
||||
|
||||
- name: Check if composer.json exists
|
||||
id: check_files
|
||||
uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673
|
||||
with:
|
||||
files: 'composer.json'
|
||||
|
||||
- name: Run composer install if composer.json exists
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: |
|
||||
rm composer.lock
|
||||
composer validate --no-check-publish
|
||||
120
.gitea/workflows/deploy.yaml
Normal file
120
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,120 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'main' ]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.gitea/workflows/release.yml'
|
||||
- 'renovate.json'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
PHP_VERSION: '8.3' # set this to the PHP version to use
|
||||
COMPOSER_ALLOW_SUPERUSER: 1
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@7c0b4c8c8ebed23eca9ec2802474895d105b11bc
|
||||
with:
|
||||
php-version: ${{ env.PHP_VERSION }}
|
||||
|
||||
- name: Check if composer.json exists
|
||||
id: check_files
|
||||
uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673
|
||||
with:
|
||||
files: 'composer.json'
|
||||
|
||||
- name: Run composer install if composer.json exists
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: |
|
||||
composer validate --no-check-publish && composer install --prefer-dist --no-progress --ignore-platform-reqs
|
||||
tar -czf typo3.tar.gz bin public packages config vendor build composer.json composer.lock
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: typo3
|
||||
path: typo3.tar.gz
|
||||
|
||||
deploy-stage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@7c0b4c8c8ebed23eca9ec2802474895d105b11bc
|
||||
with:
|
||||
php-version: ${{ env.PHP_VERSION }}
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: typo3
|
||||
- name: Extract artifact
|
||||
run: |
|
||||
tar xf typo3.tar.gz
|
||||
rm typo3.tar.gz
|
||||
- name: Install ssh agent and rsync
|
||||
run: |
|
||||
apt update
|
||||
apt install -y openssh-client rsync
|
||||
- name: Upload release
|
||||
uses: deployphp/action@v1
|
||||
with:
|
||||
deployer-binary: "./bin/dep"
|
||||
dep: --file=./build/deploy.php release:create stage
|
||||
private-key: ${{secrets.STAGE_KEY}}
|
||||
switch-stage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@7c0b4c8c8ebed23eca9ec2802474895d105b11bc
|
||||
with:
|
||||
php-version: ${{ env.PHP_VERSION }}
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: typo3
|
||||
- name: Extract artifact
|
||||
run: |
|
||||
tar xf typo3.tar.gz
|
||||
rm typo3.tar.gz
|
||||
- name: Install ssh agent and rsync
|
||||
run: |
|
||||
apt update
|
||||
apt install -y openssh-client rsync
|
||||
- name: Switch to release
|
||||
uses: deployphp/action@v1
|
||||
with:
|
||||
deployer-binary: "./bin/dep"
|
||||
dep: --file=./build/deploy.php release:switch stage
|
||||
private-key: ${{secrets.STAGE_KEY}}
|
||||
|
||||
# deploy-production:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Setup PHP
|
||||
# uses: shivammathur/setup-php@7c0b4c8c8ebed23eca9ec2802474895d105b11bc
|
||||
# with:
|
||||
# php-version: ${{ env.PHP_VERSION }}
|
||||
# - uses: actions/download-artifact@v3
|
||||
# with:
|
||||
# name: typo3
|
||||
# - name: Extract artifact
|
||||
# run: |
|
||||
# tar xf typo3.tar.gz
|
||||
# rm typo3.tar.gz
|
||||
# - name: Install ssh agent and rsync
|
||||
# run: |
|
||||
# apt update
|
||||
# apt install -y openssh-client rsync
|
||||
# - name: Deploy
|
||||
# uses: deployphp/action@v1
|
||||
# with:
|
||||
# deployer-binary: "./bin/dep"
|
||||
# dep: --file=./build/deploy.php release:create production
|
||||
# private-key: ${{secrets.PROD_KEY}}
|
||||
41
.gitea/workflows/release.yaml
Normal file
41
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
PHP_VERSION: '8.3' # set this to the PHP version to use
|
||||
COMPOSER_ALLOW_SUPERUSER: 1
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
switch-production:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@7c0b4c8c8ebed23eca9ec2802474895d105b11bc
|
||||
with:
|
||||
php-version: ${{ env.PHP_VERSION }}
|
||||
- name: Check if composer.json exists
|
||||
id: check_files
|
||||
uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673
|
||||
with:
|
||||
files: 'composer.json'
|
||||
- name: Run composer install if composer.json exists
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: |
|
||||
composer validate --no-check-publish && composer install --prefer-dist --no-progress --ignore-platform-reqs
|
||||
- name: Install ssh agent, rsync
|
||||
run: |
|
||||
apt update
|
||||
apt install -y openssh-client rsync
|
||||
- name: Switch to release
|
||||
uses: deployphp/action@v1
|
||||
with:
|
||||
deployer-binary: "./bin/dep"
|
||||
dep: --file=./build/deploy.php release:switch production
|
||||
private-key: ${{secrets.PROD_KEY}}
|
||||
140
build/deploy.php
Normal file
140
build/deploy.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
namespace Deployer;
|
||||
|
||||
require 'recipe/common.php';
|
||||
require 'contrib/rsync.php';
|
||||
require 'contrib/cachetool.php';
|
||||
|
||||
set('bin/php', function () {
|
||||
return '/run/current-system/sw/bin/php';
|
||||
});
|
||||
|
||||
set('rsync_src', '../');
|
||||
|
||||
import(__DIR__ . '/servers.yaml');
|
||||
|
||||
$sharedDirectories = [
|
||||
'public/fileadmin',
|
||||
'var'
|
||||
];
|
||||
set('shared_dirs', $sharedDirectories);
|
||||
|
||||
$sharedFiles = [
|
||||
'.env',
|
||||
'config/system/additional.php',
|
||||
];
|
||||
set('shared_files', $sharedFiles);
|
||||
|
||||
$writeableDirectories = [
|
||||
'public/typo3temp'
|
||||
];
|
||||
set('writable_dirs', $writeableDirectories);
|
||||
|
||||
$exclude = [
|
||||
'.composer-cache',
|
||||
'CODE_OF_CONDUCT.md',
|
||||
'build',
|
||||
'.git*',
|
||||
'.ddev',
|
||||
'.editorconfig',
|
||||
'.idea',
|
||||
'.php-cs-fixer.php',
|
||||
'phpstan.neon',
|
||||
];
|
||||
|
||||
set('rsync', [
|
||||
'exclude' => array_merge($sharedDirectories, $sharedFiles, $exclude),
|
||||
'exclude-file' => false,
|
||||
'include' => [],
|
||||
'include-file' => false,
|
||||
'filter' => ['dir-merge,-n /.gitignore'],
|
||||
'filter-file' => false,
|
||||
'filter-perdir' => false,
|
||||
'flags' => 'avz',
|
||||
'options' => ['delete'],
|
||||
'timeout' => 300
|
||||
]);
|
||||
|
||||
task('typo3:extension:setup', function () {
|
||||
cd('{{release_path}}');
|
||||
run('{{bin/php}} bin/typo3 extension:setup');
|
||||
});
|
||||
|
||||
task('typo3:cache:flush', function() {
|
||||
cd('current');
|
||||
run('{{bin/php}} bin/typo3 cache:flush');
|
||||
});
|
||||
|
||||
task('typo3:cache:warmup', function() {
|
||||
cd('current');
|
||||
run('{{bin/php}} bin/typo3 cache:warmup');
|
||||
});
|
||||
|
||||
task('typo3:language:update', function() {
|
||||
cd('current');
|
||||
run('{{bin/php}} bin/typo3 language:update');
|
||||
});
|
||||
|
||||
// needed for t3o infrastructure
|
||||
task('php:reload', function() {
|
||||
run('php-reload');
|
||||
})->select('stage=contentmaster');
|
||||
|
||||
task('php:reload-prod', function() {
|
||||
run('php-reload');
|
||||
})->select('stage=production');
|
||||
|
||||
// Because we are using rsync, this task is disabled
|
||||
// to avoid to trigger git
|
||||
task('deploy:update_code')->hidden()->disable();
|
||||
|
||||
task('release:create', [
|
||||
'deploy:prepare',
|
||||
'rsync',
|
||||
'deploy:vendors',
|
||||
'deploy:shared',
|
||||
'deploy:writable',
|
||||
'typo3:extension:setup',
|
||||
'deploy:unlock',
|
||||
'deploy:success'
|
||||
]);
|
||||
|
||||
task('release:switch', [
|
||||
'deploy:symlink',
|
||||
'php:reload',
|
||||
'php:reload-prod',
|
||||
'typo3:cache:flush',
|
||||
'typo3:language:update',
|
||||
'typo3:cache:warmup',
|
||||
'deploy:unlock',
|
||||
'deploy:cleanup',
|
||||
'deploy:success'
|
||||
]);
|
||||
|
||||
task('deploy', [
|
||||
'deploy:prepare',
|
||||
'rsync',
|
||||
'deploy:vendors',
|
||||
'deploy:shared',
|
||||
'deploy:writable',
|
||||
'typo3:extension:setup',
|
||||
'deploy:symlink',
|
||||
'php:reload',
|
||||
'php:reload-prod',
|
||||
'typo3:cache:flush',
|
||||
'typo3:language:update',
|
||||
'typo3:cache:warmup',
|
||||
'deploy:unlock',
|
||||
'deploy:cleanup',
|
||||
'deploy:success'
|
||||
]);
|
||||
|
||||
host('stage')
|
||||
->set('cachetool', '/var/run/phpfpm/gbv-aktuell.cloonar.dev.sock');
|
||||
|
||||
host('production')
|
||||
->set('cachetool', '/var/run/phpfpm/gbv-aktuell.at.sock');
|
||||
|
||||
after('deploy:symlink', 'cachetool:clear:opcache');
|
||||
// unlock after failure
|
||||
after('deploy:failed', 'deploy:unlock');
|
||||
17
build/servers.yaml
Normal file
17
build/servers.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
hosts:
|
||||
production:
|
||||
stage: production
|
||||
hostname: web-arm.cloonar.com
|
||||
remote_user: gbv_aktuell_at
|
||||
writable_mode: chmod
|
||||
forward_agent: true
|
||||
deploy_path: ~/
|
||||
keep_releases: 5
|
||||
stage:
|
||||
stage: staging
|
||||
hostname: web-arm.cloonar.com
|
||||
remote_user: lena_schilling_cloonar_dev
|
||||
writable_mode: chmod
|
||||
forward_agent: true
|
||||
deploy_path: ~/
|
||||
keep_releases: 1
|
||||
Reference in New Issue
Block a user