This commit is contained in:
parent
cba97991f3
commit
051b997999
8 changed files with 359 additions and 792 deletions
76
.forgejo/workflows/deployer-release-create.yaml
Normal file
76
.forgejo/workflows/deployer-release-create.yaml
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
# Generic Deployer Release Create Workflow
|
||||||
|
#
|
||||||
|
# Downloads build artifact and runs `release:create <server>` to upload a release
|
||||||
|
# without switching to it. Use deployer-release-switch.yaml to activate the release.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# jobs:
|
||||||
|
# create-stage:
|
||||||
|
# uses: infrastructure/ci-templates/.forgejo/workflows/deployer-release-create.yaml@main
|
||||||
|
# with:
|
||||||
|
# server: stage
|
||||||
|
# secrets:
|
||||||
|
# ssh_key: ${{ secrets.STAGE_KEY }}
|
||||||
|
|
||||||
|
name: Deployer Release Create
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
server:
|
||||||
|
description: 'Target server (e.g., stage, production)'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
php_version:
|
||||||
|
description: 'PHP version'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: '8.3'
|
||||||
|
deployer_file:
|
||||||
|
description: 'Path to deploy.php'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: './build/deploy.php'
|
||||||
|
artifact_name:
|
||||||
|
description: 'Name of the build artifact to download'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'build'
|
||||||
|
secrets:
|
||||||
|
ssh_key:
|
||||||
|
description: 'SSH private key for deployment'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
COMPOSER_ALLOW_SUPERUSER: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-create:
|
||||||
|
name: Create Release (${{ inputs.server }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ inputs.php_version }}
|
||||||
|
|
||||||
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.artifact_name }}
|
||||||
|
|
||||||
|
- name: Extract artifact
|
||||||
|
run: tar xf build.tar.gz && rm build.tar.gz
|
||||||
|
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: |
|
||||||
|
apt-get update -qq && apt-get install -y -qq openssh-client rsync
|
||||||
|
composer require deployer/deployer --dev -q
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
uses: deployphp/action@v1
|
||||||
|
with:
|
||||||
|
deployer-binary: "./bin/dep"
|
||||||
|
dep: -q --file=${{ inputs.deployer_file }} release:create ${{ inputs.server }}
|
||||||
|
private-key: ${{ secrets.ssh_key }}
|
||||||
77
.forgejo/workflows/deployer-release-switch.yaml
Normal file
77
.forgejo/workflows/deployer-release-switch.yaml
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
# Generic Deployer Release Switch Workflow
|
||||||
|
#
|
||||||
|
# Downloads build artifact and runs `release:switch <server>` to activate
|
||||||
|
# a previously uploaded release. Use after deployer-release-create.yaml.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# jobs:
|
||||||
|
# switch-stage:
|
||||||
|
# needs: create-stage
|
||||||
|
# uses: infrastructure/ci-templates/.forgejo/workflows/deployer-release-switch.yaml@main
|
||||||
|
# with:
|
||||||
|
# server: stage
|
||||||
|
# secrets:
|
||||||
|
# ssh_key: ${{ secrets.STAGE_KEY }}
|
||||||
|
|
||||||
|
name: Deployer Release Switch
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
server:
|
||||||
|
description: 'Target server (e.g., stage, production)'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
php_version:
|
||||||
|
description: 'PHP version'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: '8.3'
|
||||||
|
deployer_file:
|
||||||
|
description: 'Path to deploy.php'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: './build/deploy.php'
|
||||||
|
artifact_name:
|
||||||
|
description: 'Name of the build artifact to download'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'build'
|
||||||
|
secrets:
|
||||||
|
ssh_key:
|
||||||
|
description: 'SSH private key for deployment'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
COMPOSER_ALLOW_SUPERUSER: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-switch:
|
||||||
|
name: Switch Release (${{ inputs.server }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ inputs.php_version }}
|
||||||
|
|
||||||
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.artifact_name }}
|
||||||
|
|
||||||
|
- name: Extract artifact
|
||||||
|
run: tar xf build.tar.gz && rm build.tar.gz
|
||||||
|
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: |
|
||||||
|
apt-get update -qq && apt-get install -y -qq openssh-client rsync
|
||||||
|
composer require deployer/deployer --dev -q
|
||||||
|
|
||||||
|
- name: Switch release
|
||||||
|
uses: deployphp/action@v1
|
||||||
|
with:
|
||||||
|
deployer-binary: "./bin/dep"
|
||||||
|
dep: -q --file=${{ inputs.deployer_file }} release:switch ${{ inputs.server }}
|
||||||
|
private-key: ${{ secrets.ssh_key }}
|
||||||
|
|
@ -1,258 +0,0 @@
|
||||||
# Cloonar TYPO3 Staged Deployment Workflow
|
|
||||||
#
|
|
||||||
# Staged deployment: build → deploy to stage → run E2E tests → switch release
|
|
||||||
#
|
|
||||||
# Usage in project's .forgejo/workflows/deploy.yaml:
|
|
||||||
# name: Deploy
|
|
||||||
# on:
|
|
||||||
# push:
|
|
||||||
# branches: [main]
|
|
||||||
# jobs:
|
|
||||||
# deploy:
|
|
||||||
# uses: infrastructure/ci-templates/.forgejo/workflows/typo3-staged-deploy.yaml@main
|
|
||||||
# with:
|
|
||||||
# stage_url: https://myproject.cloonar.dev
|
|
||||||
# php_version: '8.3'
|
|
||||||
# secrets:
|
|
||||||
# stage_key: ${{ secrets.STAGE_KEY }}
|
|
||||||
# prod_key: ${{ secrets.PROD_KEY }}
|
|
||||||
|
|
||||||
name: TYPO3 Staged Deploy
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
stage_url:
|
|
||||||
description: 'Staging URL for E2E tests'
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
php_version:
|
|
||||||
description: 'PHP version'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: '8.3'
|
|
||||||
node_version:
|
|
||||||
description: 'Node.js version'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: '20'
|
|
||||||
build_frontend:
|
|
||||||
description: 'Run npm build'
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
run_e2e_tests:
|
|
||||||
description: 'Run Playwright E2E tests'
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
e2e_path:
|
|
||||||
description: 'Path to E2E tests'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: 'tests/e2e'
|
|
||||||
deployer_file:
|
|
||||||
description: 'Path to deploy.php'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: './build/deploy.php'
|
|
||||||
deploy_production:
|
|
||||||
description: 'Also deploy to production after stage succeeds'
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
secrets:
|
|
||||||
stage_key:
|
|
||||||
description: 'SSH key for staging'
|
|
||||||
required: true
|
|
||||||
prod_key:
|
|
||||||
description: 'SSH key for production'
|
|
||||||
required: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
COMPOSER_ALLOW_SUPERUSER: 1
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# ===========================================================================
|
|
||||||
# Build
|
|
||||||
# ===========================================================================
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
tools: composer
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
if: ${{ inputs.build_frontend }}
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ inputs.node_version }}
|
|
||||||
|
|
||||||
- name: Install PHP dependencies
|
|
||||||
run: composer install --prefer-dist --no-progress --no-dev --ignore-platform-reqs
|
|
||||||
|
|
||||||
- name: Install Node dependencies & build
|
|
||||||
if: ${{ fromJSON(inputs.build_frontend) }}
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
- name: Create artifact
|
|
||||||
run: |
|
|
||||||
tar -czf build.tar.gz \
|
|
||||||
bin public packages config vendor build composer.json composer.lock \
|
|
||||||
$([ -d "node_modules" ] && echo "node_modules") \
|
|
||||||
$([ -d "dist" ] && echo "dist") \
|
|
||||||
2>/dev/null || true
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
path: build.tar.gz
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# Deploy to Stage (release:create only)
|
|
||||||
# ===========================================================================
|
|
||||||
deploy-stage:
|
|
||||||
name: Upload to Stage
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
|
|
||||||
- run: tar xf build.tar.gz && rm build.tar.gz
|
|
||||||
|
|
||||||
- run: apt-get update && apt-get install -y openssh-client rsync
|
|
||||||
|
|
||||||
- name: Upload release
|
|
||||||
uses: deployphp/action@v1
|
|
||||||
with:
|
|
||||||
deployer-binary: "./bin/dep"
|
|
||||||
dep: --file=${{ inputs.deployer_file }} release:create stage
|
|
||||||
private-key: ${{ secrets.stage_key }}
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# Switch Stage Release
|
|
||||||
# ===========================================================================
|
|
||||||
switch-stage:
|
|
||||||
name: Activate Stage Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [deploy-stage]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
|
|
||||||
- run: tar xf build.tar.gz && rm build.tar.gz
|
|
||||||
|
|
||||||
- run: apt-get update && apt-get install -y openssh-client rsync
|
|
||||||
|
|
||||||
- name: Switch release
|
|
||||||
uses: deployphp/action@v1
|
|
||||||
with:
|
|
||||||
deployer-binary: "./bin/dep"
|
|
||||||
dep: --file=${{ inputs.deployer_file }} release:switch stage
|
|
||||||
private-key: ${{ secrets.stage_key }}
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# E2E Tests with Playwright
|
|
||||||
# ===========================================================================
|
|
||||||
test-stage:
|
|
||||||
name: E2E Tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [switch-stage]
|
|
||||||
if: ${{ inputs.run_e2e_tests }}
|
|
||||||
container:
|
|
||||||
image: mcr.microsoft.com/playwright:v1.50.0-noble
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
working-directory: ${{ inputs.e2e_path }}
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run smoke tests
|
|
||||||
working-directory: ${{ inputs.e2e_path }}
|
|
||||||
env:
|
|
||||||
TEST_URL: ${{ inputs.stage_url }}
|
|
||||||
run: npx playwright test smoke
|
|
||||||
|
|
||||||
- name: Run visual regression tests
|
|
||||||
working-directory: ${{ inputs.e2e_path }}
|
|
||||||
env:
|
|
||||||
TEST_URL: ${{ inputs.stage_url }}
|
|
||||||
run: npx playwright test visual
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Upload test report
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: playwright-report
|
|
||||||
path: ${{ inputs.e2e_path }}/playwright-report/
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
- name: Upload diff screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: visual-diff
|
|
||||||
path: ${{ inputs.e2e_path }}/test-results/
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# Deploy to Production
|
|
||||||
# ===========================================================================
|
|
||||||
deploy-production:
|
|
||||||
name: Deploy Production
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [test-stage]
|
|
||||||
if: ${{ inputs.deploy_production && (needs.test-stage.result == 'success' || needs.test-stage.result == 'skipped') }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
|
|
||||||
- run: tar xf build.tar.gz && rm build.tar.gz
|
|
||||||
|
|
||||||
- run: apt-get update && apt-get install -y openssh-client rsync
|
|
||||||
|
|
||||||
- name: Deploy to production
|
|
||||||
uses: deployphp/action@v1
|
|
||||||
with:
|
|
||||||
deployer-binary: "./bin/dep"
|
|
||||||
dep: --file=${{ inputs.deployer_file }} release:create production
|
|
||||||
private-key: ${{ secrets.prod_key }}
|
|
||||||
|
|
@ -1,23 +1,17 @@
|
||||||
# Cloonar TYPO3 Staged Deployment Workflow
|
# TYPO3 Build Workflow
|
||||||
#
|
#
|
||||||
# Staged deployment: build → deploy to stage → run E2E tests → switch release
|
# Builds PHP/Node artifacts and uploads them for subsequent deployment jobs.
|
||||||
#
|
# Use this as the first step in your composable deployment pipeline.
|
||||||
# Usage in project's .forgejo/workflows/deploy.yaml:
|
#
|
||||||
# name: Deploy
|
# Usage:
|
||||||
# on:
|
|
||||||
# push:
|
|
||||||
# branches: [main]
|
|
||||||
# jobs:
|
# jobs:
|
||||||
# deploy:
|
# build:
|
||||||
# uses: infrastructure/ci-templates/.forgejo/workflows/typo3-staged-deploy.yaml@main
|
# uses: infrastructure/ci-templates/.forgejo/workflows/typo3-build.yaml@main
|
||||||
# with:
|
# with:
|
||||||
# stage_url: https://myproject.cloonar.dev
|
|
||||||
# php_version: '8.3'
|
# php_version: '8.3'
|
||||||
# secrets:
|
# build_frontend: true
|
||||||
# stage_key: ${{ secrets.STAGE_KEY }}
|
|
||||||
# prod_key: ${{ secrets.PROD_KEY }}
|
|
||||||
|
|
||||||
name: TYPO3 Staged Deploy
|
name: TYPO3 Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
@ -27,14 +21,26 @@ on:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: '8.3'
|
default: '8.3'
|
||||||
|
node_version:
|
||||||
|
description: 'Node.js version'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: '20'
|
||||||
|
build_frontend:
|
||||||
|
description: 'Run npm build'
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
artifact_name:
|
||||||
|
description: 'Name of the build artifact to upload'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'build'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
COMPOSER_ALLOW_SUPERUSER: 1
|
COMPOSER_ALLOW_SUPERUSER: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ===========================================================================
|
|
||||||
# Build
|
|
||||||
# ===========================================================================
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -48,21 +54,32 @@ jobs:
|
||||||
php-version: ${{ inputs.php_version }}
|
php-version: ${{ inputs.php_version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
if: ${{ inputs.build_frontend }}
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ inputs.node_version }}
|
||||||
|
|
||||||
- name: Install PHP dependencies
|
- name: Install PHP dependencies
|
||||||
|
run: composer install --prefer-dist --no-progress --no-dev --ignore-platform-reqs
|
||||||
|
|
||||||
|
- name: Install Node dependencies & build
|
||||||
|
if: ${{ inputs.build_frontend }}
|
||||||
run: |
|
run: |
|
||||||
composer install --prefer-dist --no-progress --no-dev --ignore-platform-reqs
|
npm ci
|
||||||
curl -o deploy-lib.php https://git.cloonar.com/infrastructure/ci-templates/raw/branch/main/deployer/typo3-recipe.php
|
npm run build
|
||||||
|
|
||||||
- name: Create artifact
|
- name: Create artifact
|
||||||
run: |
|
run: |
|
||||||
tar -czf build.tar.gz \
|
tar -czf build.tar.gz \
|
||||||
bin public packages config vendor build composer.json composer.lock deploy-lib.php \
|
bin public packages config vendor build composer.json composer.lock \
|
||||||
$([ -d "node_modules" ] && echo "node_modules") \
|
$([ -d "node_modules" ] && echo "node_modules") \
|
||||||
$([ -d "dist" ] && echo "dist") \
|
$([ -d "dist" ] && echo "dist") \
|
||||||
2>/dev/null || true
|
2>/dev/null || true
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: build-${{ github.sha }}
|
name: ${{ inputs.artifact_name }}
|
||||||
path: build.tar.gz
|
path: build.tar.gz
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
|
||||||
|
|
@ -1,212 +0,0 @@
|
||||||
# Cloonar TYPO3 Staged Deployment Workflow
|
|
||||||
#
|
|
||||||
# Staged deployment: build → deploy to stage → run E2E tests → switch release
|
|
||||||
#
|
|
||||||
# Usage in project's .forgejo/workflows/deploy.yaml:
|
|
||||||
# name: Deploy
|
|
||||||
# on:
|
|
||||||
# push:
|
|
||||||
# branches: [main]
|
|
||||||
# jobs:
|
|
||||||
# deploy:
|
|
||||||
# uses: infrastructure/ci-templates/.forgejo/workflows/typo3-staged-deploy.yaml@main
|
|
||||||
# with:
|
|
||||||
# stage_url: https://myproject.cloonar.dev
|
|
||||||
# php_version: '8.3'
|
|
||||||
# secrets:
|
|
||||||
# stage_key: ${{ secrets.STAGE_KEY }}
|
|
||||||
# prod_key: ${{ secrets.PROD_KEY }}
|
|
||||||
|
|
||||||
name: TYPO3 Staged Deploy
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
stage_url:
|
|
||||||
description: 'Staging URL for E2E tests'
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
php_version:
|
|
||||||
description: 'PHP version'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: '8.3'
|
|
||||||
node_version:
|
|
||||||
description: 'Node.js version'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: '20'
|
|
||||||
run_e2e_tests:
|
|
||||||
description: 'Run Playwright E2E tests'
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
e2e_path:
|
|
||||||
description: 'Path to E2E tests'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: 'tests/e2e'
|
|
||||||
deployer_file:
|
|
||||||
description: 'Path to deploy.php'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: './build/deploy.php'
|
|
||||||
deploy_production:
|
|
||||||
description: 'Also deploy to production after stage succeeds'
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
secrets:
|
|
||||||
stage_key:
|
|
||||||
description: 'SSH key for staging'
|
|
||||||
required: true
|
|
||||||
prod_key:
|
|
||||||
description: 'SSH key for production'
|
|
||||||
required: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
COMPOSER_ALLOW_SUPERUSER: 1
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# ===========================================================================
|
|
||||||
# Deploy to Stage (release:create only)
|
|
||||||
# ===========================================================================
|
|
||||||
deploy-stage:
|
|
||||||
name: Upload to Stage
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
tar xf build.tar.gz && rm build.tar.gz
|
|
||||||
composer require deployer/deployer --dev -q
|
|
||||||
|
|
||||||
- run: apt-get update -qq && apt-get install -y -qq openssh-client rsync
|
|
||||||
|
|
||||||
- name: Upload release
|
|
||||||
uses: deployphp/action@v1
|
|
||||||
with:
|
|
||||||
deployer-binary: "./bin/dep"
|
|
||||||
dep: -q --file=${{ inputs.deployer_file }} release:create stage
|
|
||||||
private-key: ${{ secrets.stage_key }}
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# Switch Stage Release
|
|
||||||
# ===========================================================================
|
|
||||||
switch-stage:
|
|
||||||
name: Activate Stage Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [deploy-stage]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
tar xf build.tar.gz && rm build.tar.gz
|
|
||||||
composer require deployer/deployer --dev -q
|
|
||||||
|
|
||||||
- run: apt-get update -qq && apt-get install -y -qq openssh-client rsync
|
|
||||||
|
|
||||||
- name: Switch release
|
|
||||||
uses: deployphp/action@v1
|
|
||||||
with:
|
|
||||||
deployer-binary: "./bin/dep"
|
|
||||||
dep: -q --file=${{ inputs.deployer_file }} release:switch stage
|
|
||||||
private-key: ${{ secrets.stage_key }}
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# E2E Tests with Playwright
|
|
||||||
# ===========================================================================
|
|
||||||
test-stage:
|
|
||||||
name: E2E Tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [switch-stage]
|
|
||||||
if: ${{ inputs.run_e2e_tests }}
|
|
||||||
container:
|
|
||||||
image: mcr.microsoft.com/playwright:v1.50.0-noble
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
working-directory: ${{ inputs.e2e_path }}
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run smoke tests
|
|
||||||
working-directory: ${{ inputs.e2e_path }}
|
|
||||||
env:
|
|
||||||
TEST_URL: ${{ inputs.stage_url }}
|
|
||||||
run: npx playwright test smoke
|
|
||||||
|
|
||||||
- name: Run visual regression tests
|
|
||||||
working-directory: ${{ inputs.e2e_path }}
|
|
||||||
env:
|
|
||||||
TEST_URL: ${{ inputs.stage_url }}
|
|
||||||
run: npx playwright test visual
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Upload test report
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: playwright-report
|
|
||||||
path: ${{ inputs.e2e_path }}/playwright-report/
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
- name: Upload diff screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: visual-diff
|
|
||||||
path: ${{ inputs.e2e_path }}/test-results/
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# Deploy to Production
|
|
||||||
# ===========================================================================
|
|
||||||
deploy-production:
|
|
||||||
name: Deploy Production
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [switch-stage, test-stage]
|
|
||||||
if: ${{ always() && inputs.deploy_production && needs.switch-stage.result == 'success' && needs.test-stage.result != 'failure' }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
tar xf build.tar.gz && rm build.tar.gz
|
|
||||||
composer require deployer/deployer --dev -q
|
|
||||||
|
|
||||||
- run: apt-get update -qq && apt-get install -y -qq openssh-client rsync
|
|
||||||
|
|
||||||
- name: Deploy to production
|
|
||||||
uses: deployphp/action@v1
|
|
||||||
with:
|
|
||||||
deployer-binary: "./bin/dep"
|
|
||||||
dep: -q --file=${{ inputs.deployer_file }} release:create production
|
|
||||||
private-key: ${{ secrets.prod_key }}
|
|
||||||
81
.forgejo/workflows/typo3-e2e-test.yaml
Normal file
81
.forgejo/workflows/typo3-e2e-test.yaml
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
# TYPO3 E2E Test Workflow
|
||||||
|
#
|
||||||
|
# Runs Playwright E2E tests against a deployed environment.
|
||||||
|
# Includes smoke tests and optional visual regression tests.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# jobs:
|
||||||
|
# test:
|
||||||
|
# needs: switch-stage
|
||||||
|
# uses: infrastructure/ci-templates/.forgejo/workflows/typo3-e2e-test.yaml@main
|
||||||
|
# with:
|
||||||
|
# test_url: https://myproject.cloonar.dev
|
||||||
|
|
||||||
|
name: TYPO3 E2E Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
test_url:
|
||||||
|
description: 'URL to test against'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
e2e_path:
|
||||||
|
description: 'Path to E2E test directory'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'tests/e2e'
|
||||||
|
run_visual_tests:
|
||||||
|
description: 'Run visual regression tests'
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
visual_tests_continue_on_error:
|
||||||
|
description: 'Continue if visual tests fail'
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
e2e-test:
|
||||||
|
name: E2E Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: mcr.microsoft.com/playwright:v1.50.0-noble
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
working-directory: ${{ inputs.e2e_path }}
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run smoke tests
|
||||||
|
working-directory: ${{ inputs.e2e_path }}
|
||||||
|
env:
|
||||||
|
TEST_URL: ${{ inputs.test_url }}
|
||||||
|
run: npx playwright test smoke
|
||||||
|
|
||||||
|
- name: Run visual regression tests
|
||||||
|
if: ${{ inputs.run_visual_tests }}
|
||||||
|
working-directory: ${{ inputs.e2e_path }}
|
||||||
|
env:
|
||||||
|
TEST_URL: ${{ inputs.test_url }}
|
||||||
|
run: npx playwright test visual
|
||||||
|
continue-on-error: ${{ inputs.visual_tests_continue_on_error }}
|
||||||
|
|
||||||
|
- name: Upload test report
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: playwright-report
|
||||||
|
path: ${{ inputs.e2e_path }}/playwright-report/
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
- name: Upload diff screenshots
|
||||||
|
if: failure()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: visual-diff
|
||||||
|
path: ${{ inputs.e2e_path }}/test-results/
|
||||||
|
retention-days: 7
|
||||||
|
|
@ -1,258 +0,0 @@
|
||||||
# Cloonar TYPO3 Staged Deployment Workflow
|
|
||||||
#
|
|
||||||
# Staged deployment: build → deploy to stage → run E2E tests → switch release
|
|
||||||
#
|
|
||||||
# Usage in project's .forgejo/workflows/deploy.yaml:
|
|
||||||
# name: Deploy
|
|
||||||
# on:
|
|
||||||
# push:
|
|
||||||
# branches: [main]
|
|
||||||
# jobs:
|
|
||||||
# deploy:
|
|
||||||
# uses: infrastructure/ci-templates/.forgejo/workflows/typo3-staged-deploy.yaml@main
|
|
||||||
# with:
|
|
||||||
# stage_url: https://myproject.cloonar.dev
|
|
||||||
# php_version: '8.3'
|
|
||||||
# secrets:
|
|
||||||
# stage_key: ${{ secrets.STAGE_KEY }}
|
|
||||||
# prod_key: ${{ secrets.PROD_KEY }}
|
|
||||||
|
|
||||||
name: TYPO3 Staged Deploy
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
stage_url:
|
|
||||||
description: 'Staging URL for E2E tests'
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
php_version:
|
|
||||||
description: 'PHP version'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: '8.3'
|
|
||||||
node_version:
|
|
||||||
description: 'Node.js version'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: '20'
|
|
||||||
build_frontend:
|
|
||||||
description: 'Run npm build'
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
run_e2e_tests:
|
|
||||||
description: 'Run Playwright E2E tests'
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
e2e_path:
|
|
||||||
description: 'Path to E2E tests'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: 'tests/e2e'
|
|
||||||
deployer_file:
|
|
||||||
description: 'Path to deploy.php'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: './build/deploy.php'
|
|
||||||
deploy_production:
|
|
||||||
description: 'Also deploy to production after stage succeeds'
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
secrets:
|
|
||||||
stage_key:
|
|
||||||
description: 'SSH key for staging'
|
|
||||||
required: true
|
|
||||||
prod_key:
|
|
||||||
description: 'SSH key for production'
|
|
||||||
required: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
COMPOSER_ALLOW_SUPERUSER: 1
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# ===========================================================================
|
|
||||||
# Build
|
|
||||||
# ===========================================================================
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
tools: composer
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
if: ${{ inputs.build_frontend }}
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ inputs.node_version }}
|
|
||||||
|
|
||||||
- name: Install PHP dependencies
|
|
||||||
run: composer install --prefer-dist --no-progress --no-dev --ignore-platform-reqs
|
|
||||||
|
|
||||||
- name: Install Node dependencies & build
|
|
||||||
if: ${{ fromJSON(inputs.build_frontend) }}
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
- name: Create artifact
|
|
||||||
run: |
|
|
||||||
tar -czf build.tar.gz \
|
|
||||||
bin public packages config vendor build composer.json composer.lock \
|
|
||||||
$([ -d "node_modules" ] && echo "node_modules") \
|
|
||||||
$([ -d "dist" ] && echo "dist") \
|
|
||||||
2>/dev/null || true
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
path: build.tar.gz
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# Deploy to Stage (release:create only)
|
|
||||||
# ===========================================================================
|
|
||||||
deploy-stage:
|
|
||||||
name: Upload to Stage
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
|
|
||||||
- run: tar xf build.tar.gz && rm build.tar.gz
|
|
||||||
|
|
||||||
- run: apt-get update && apt-get install -y openssh-client rsync
|
|
||||||
|
|
||||||
- name: Upload release
|
|
||||||
uses: deployphp/action@v1
|
|
||||||
with:
|
|
||||||
deployer-binary: "./bin/dep"
|
|
||||||
dep: --file=${{ inputs.deployer_file }} release:create stage
|
|
||||||
private-key: ${{ secrets.stage_key }}
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# Switch Stage Release
|
|
||||||
# ===========================================================================
|
|
||||||
switch-stage:
|
|
||||||
name: Activate Stage Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [deploy-stage]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
|
|
||||||
- run: tar xf build.tar.gz && rm build.tar.gz
|
|
||||||
|
|
||||||
- run: apt-get update && apt-get install -y openssh-client rsync
|
|
||||||
|
|
||||||
- name: Switch release
|
|
||||||
uses: deployphp/action@v1
|
|
||||||
with:
|
|
||||||
deployer-binary: "./bin/dep"
|
|
||||||
dep: --file=${{ inputs.deployer_file }} release:switch stage
|
|
||||||
private-key: ${{ secrets.stage_key }}
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# E2E Tests with Playwright
|
|
||||||
# ===========================================================================
|
|
||||||
test-stage:
|
|
||||||
name: E2E Tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [switch-stage]
|
|
||||||
if: ${{ inputs.run_e2e_tests }}
|
|
||||||
container:
|
|
||||||
image: mcr.microsoft.com/playwright:v1.50.0-noble
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
working-directory: ${{ inputs.e2e_path }}
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run smoke tests
|
|
||||||
working-directory: ${{ inputs.e2e_path }}
|
|
||||||
env:
|
|
||||||
TEST_URL: ${{ inputs.stage_url }}
|
|
||||||
run: npx playwright test smoke
|
|
||||||
|
|
||||||
- name: Run visual regression tests
|
|
||||||
working-directory: ${{ inputs.e2e_path }}
|
|
||||||
env:
|
|
||||||
TEST_URL: ${{ inputs.stage_url }}
|
|
||||||
run: npx playwright test visual
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Upload test report
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: playwright-report
|
|
||||||
path: ${{ inputs.e2e_path }}/playwright-report/
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
- name: Upload diff screenshots
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: visual-diff
|
|
||||||
path: ${{ inputs.e2e_path }}/test-results/
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# Deploy to Production
|
|
||||||
# ===========================================================================
|
|
||||||
deploy-production:
|
|
||||||
name: Deploy Production
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [test-stage]
|
|
||||||
if: ${{ inputs.deploy_production && (needs.test-stage.result == 'success' || needs.test-stage.result == 'skipped') }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php_version }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build-${{ github.sha }}
|
|
||||||
|
|
||||||
- run: tar xf build.tar.gz && rm build.tar.gz
|
|
||||||
|
|
||||||
- run: apt-get update && apt-get install -y openssh-client rsync
|
|
||||||
|
|
||||||
- name: Deploy to production
|
|
||||||
uses: deployphp/action@v1
|
|
||||||
with:
|
|
||||||
deployer-binary: "./bin/dep"
|
|
||||||
dep: --file=${{ inputs.deployer_file }} release:create production
|
|
||||||
private-key: ${{ secrets.prod_key }}
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
# Cloonar TYPO3 Staged Deployment Workflow
|
# TYPO3 Staged Deployment Workflow (Convenience Wrapper)
|
||||||
#
|
#
|
||||||
# Staged deployment: build → deploy to stage → run E2E tests → switch release
|
# All-in-one workflow: build → deploy to stage → test → optionally deploy to production
|
||||||
#
|
# For more control and visibility, use the composable workflows directly:
|
||||||
# Usage in project's .forgejo/workflows/deploy.yaml:
|
# - typo3-build.yaml
|
||||||
# name: Deploy
|
# - deployer-release-create.yaml
|
||||||
# on:
|
# - deployer-release-switch.yaml
|
||||||
# push:
|
# - typo3-e2e-test.yaml
|
||||||
# branches: [main]
|
#
|
||||||
|
# Usage:
|
||||||
# jobs:
|
# jobs:
|
||||||
# deploy:
|
# deploy:
|
||||||
# uses: infrastructure/ci-templates/.forgejo/workflows/typo3-staged-deploy.yaml@main
|
# uses: infrastructure/ci-templates/.forgejo/workflows/typo3-staged-deploy.yaml@main
|
||||||
# with:
|
# with:
|
||||||
# stage_url: https://myproject.cloonar.dev
|
# stage_url: https://myproject.cloonar.dev
|
||||||
# php_version: '8.3'
|
|
||||||
# secrets:
|
# secrets:
|
||||||
# stage_key: ${{ secrets.STAGE_KEY }}
|
# stage_key: ${{ secrets.STAGE_KEY }}
|
||||||
# prod_key: ${{ secrets.PROD_KEY }}
|
# prod_key: ${{ secrets.PROD_KEY }}
|
||||||
|
|
@ -57,7 +57,7 @@ on:
|
||||||
type: string
|
type: string
|
||||||
default: './build/deploy.php'
|
default: './build/deploy.php'
|
||||||
deploy_production:
|
deploy_production:
|
||||||
description: 'Also deploy to production after stage succeeds'
|
description: 'Deploy to production after tests pass'
|
||||||
required: false
|
required: false
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
|
|
@ -90,7 +90,7 @@ jobs:
|
||||||
tools: composer
|
tools: composer
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
if: ${{ fromJSON(inputs.build_frontend) }}
|
if: ${{ inputs.build_frontend }}
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ inputs.node_version }}
|
node-version: ${{ inputs.node_version }}
|
||||||
|
|
@ -99,7 +99,7 @@ jobs:
|
||||||
run: composer install --prefer-dist --no-progress --no-dev --ignore-platform-reqs
|
run: composer install --prefer-dist --no-progress --no-dev --ignore-platform-reqs
|
||||||
|
|
||||||
- name: Install Node dependencies & build
|
- name: Install Node dependencies & build
|
||||||
if: ${{ fromJSON(inputs.build_frontend) }}
|
if: ${{ inputs.build_frontend }}
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
npm ci
|
||||||
npm run build
|
npm run build
|
||||||
|
|
@ -112,7 +112,8 @@ jobs:
|
||||||
$([ -d "dist" ] && echo "dist") \
|
$([ -d "dist" ] && echo "dist") \
|
||||||
2>/dev/null || true
|
2>/dev/null || true
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-${{ github.sha }}
|
name: build-${{ github.sha }}
|
||||||
path: build.tar.gz
|
path: build.tar.gz
|
||||||
|
|
@ -120,10 +121,10 @@ jobs:
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
# Deploy to Stage (release:create only)
|
# Create Stage Release
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
deploy-stage:
|
create-stage:
|
||||||
name: Upload to Stage
|
name: Create Release (stage)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build]
|
needs: [build]
|
||||||
|
|
||||||
|
|
@ -133,19 +134,22 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ inputs.php_version }}
|
php-version: ${{ inputs.php_version }}
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-${{ github.sha }}
|
name: build-${{ github.sha }}
|
||||||
|
|
||||||
- run: tar xf build.tar.gz && rm build.tar.gz
|
- name: Extract artifact
|
||||||
|
run: tar xf build.tar.gz && rm build.tar.gz
|
||||||
|
|
||||||
- run: apt-get update && apt-get install -y openssh-client rsync
|
- name: Install system dependencies
|
||||||
|
run: apt-get update -qq && apt-get install -y -qq openssh-client rsync
|
||||||
|
|
||||||
- name: Upload release
|
- name: Create release
|
||||||
uses: deployphp/action@v1
|
uses: deployphp/action@v1
|
||||||
with:
|
with:
|
||||||
deployer-binary: "./bin/dep"
|
deployer-binary: "./bin/dep"
|
||||||
dep: --file=${{ inputs.deployer_file }} release:create stage
|
dep: -q --file=${{ inputs.deployer_file }} release:create stage
|
||||||
private-key: ${{ secrets.stage_key }}
|
private-key: ${{ secrets.stage_key }}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -153,9 +157,9 @@ jobs:
|
||||||
# Switch Stage Release
|
# Switch Stage Release
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
switch-stage:
|
switch-stage:
|
||||||
name: Activate Stage Release
|
name: Switch Release (stage)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [deploy-stage]
|
needs: [create-stage]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|
@ -163,24 +167,27 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ inputs.php_version }}
|
php-version: ${{ inputs.php_version }}
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-${{ github.sha }}
|
name: build-${{ github.sha }}
|
||||||
|
|
||||||
- run: tar xf build.tar.gz && rm build.tar.gz
|
- name: Extract artifact
|
||||||
|
run: tar xf build.tar.gz && rm build.tar.gz
|
||||||
|
|
||||||
- run: apt-get update && apt-get install -y openssh-client rsync
|
- name: Install system dependencies
|
||||||
|
run: apt-get update -qq && apt-get install -y -qq openssh-client rsync
|
||||||
|
|
||||||
- name: Switch release
|
- name: Switch release
|
||||||
uses: deployphp/action@v1
|
uses: deployphp/action@v1
|
||||||
with:
|
with:
|
||||||
deployer-binary: "./bin/dep"
|
deployer-binary: "./bin/dep"
|
||||||
dep: --file=${{ inputs.deployer_file }} release:switch stage
|
dep: -q --file=${{ inputs.deployer_file }} release:switch stage
|
||||||
private-key: ${{ secrets.stage_key }}
|
private-key: ${{ secrets.stage_key }}
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
# E2E Tests with Playwright
|
# E2E Tests
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
test-stage:
|
test-stage:
|
||||||
name: E2E Tests
|
name: E2E Tests
|
||||||
|
|
@ -228,13 +235,13 @@ jobs:
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
# Deploy to Production
|
# Create Production Release
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
deploy-production:
|
create-production:
|
||||||
name: Deploy Production
|
name: Create Release (production)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [test-stage]
|
needs: [switch-stage, test-stage]
|
||||||
if: ${{ inputs.deploy_production && (needs.test-stage.result == 'success' || needs.test-stage.result == 'skipped') }}
|
if: ${{ always() && inputs.deploy_production && needs.switch-stage.result == 'success' && needs.test-stage.result != 'failure' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
|
|
@ -242,17 +249,54 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ inputs.php_version }}
|
php-version: ${{ inputs.php_version }}
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-${{ github.sha }}
|
name: build-${{ github.sha }}
|
||||||
|
|
||||||
- run: tar xf build.tar.gz && rm build.tar.gz
|
- name: Extract artifact
|
||||||
|
run: tar xf build.tar.gz && rm build.tar.gz
|
||||||
|
|
||||||
- run: apt-get update && apt-get install -y openssh-client rsync
|
- name: Install system dependencies
|
||||||
|
run: apt-get update -qq && apt-get install -y -qq openssh-client rsync
|
||||||
|
|
||||||
- name: Deploy to production
|
- name: Create release
|
||||||
uses: deployphp/action@v1
|
uses: deployphp/action@v1
|
||||||
with:
|
with:
|
||||||
deployer-binary: "./bin/dep"
|
deployer-binary: "./bin/dep"
|
||||||
dep: --file=${{ inputs.deployer_file }} release:create production
|
dep: -q --file=${{ inputs.deployer_file }} release:create production
|
||||||
|
private-key: ${{ secrets.prod_key }}
|
||||||
|
|
||||||
|
|
||||||
|
# ===========================================================================
|
||||||
|
# Switch Production Release
|
||||||
|
# ===========================================================================
|
||||||
|
switch-production:
|
||||||
|
name: Switch Release (production)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [create-production]
|
||||||
|
if: ${{ always() && needs.create-production.result == 'success' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ inputs.php_version }}
|
||||||
|
|
||||||
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Extract artifact
|
||||||
|
run: tar xf build.tar.gz && rm build.tar.gz
|
||||||
|
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: apt-get update -qq && apt-get install -y -qq openssh-client rsync
|
||||||
|
|
||||||
|
- name: Switch release
|
||||||
|
uses: deployphp/action@v1
|
||||||
|
with:
|
||||||
|
deployer-binary: "./bin/dep"
|
||||||
|
dep: -q --file=${{ inputs.deployer_file }} release:switch production
|
||||||
private-key: ${{ secrets.prod_key }}
|
private-key: ${{ secrets.prod_key }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue