Skip to content

Trigger Forge deploy #652

Trigger Forge deploy

Trigger Forge deploy #652

Workflow file for this run

name: Trigger Forge deploy
on:
workflow_run:
workflows: [ 'CI' ]
types:
- completed
jobs:
forge:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
timeout-minutes: 10
name: Deploy application
steps:
- uses: actions/checkout@v3
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
- name: Install Forge CLI
run: composer global require laravel/forge-cli
- name: Authenticate with Forge
run: forge login --token=${{ secrets.FORGE_API_TOKEN }}
# Forge environment variables, including the current git commit hash,
# aren't included as runtime environment variables and only in the build script.
# To get the current commit propagated, pull the current production configuration,
# and append the current commit to the file and push it back up to Forge.
- name: Download current configuration
run: forge env:pull ${{ secrets.FORGE_SITE_NAME }} ${{ github.workspace }}/.env
- name: Add current commit and push back to forge
run: |
chmod +x ./scripts/update-commit.sh
./scripts/update-commit.sh COMMIT_SHA ${{ github.sha }}
working-directory: ${{ github.workspace }}
- name: Push environment to Forge
run: forge env:push ${{ secrets.FORGE_SITE_NAME }} ${{ github.workspace }}/.env
- name: Ping deploy URL
run: curl -l ${{ secrets.FORGE_DEPLOY_URL }}