76 lines
2 KiB
YAML
76 lines
2 KiB
YAML
# 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@v3
|
|
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 }}
|