# Generic Deployer Release Switch Workflow # # Downloads build artifact and runs `release:switch ` 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 }}