Skip to content

Instantly share code, notes, and snippets.

@jonassiewertsen
Last active June 30, 2022 13:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonassiewertsen/0b32694ddeacbc15a292ce27c0b73bb4 to your computer and use it in GitHub Desktop.
Save jonassiewertsen/0b32694ddeacbc15a292ce27c0b73bb4 to your computer and use it in GitHub Desktop.
Sharing some different scripts to use Deployer and GitHub actions
import:
- recipe/statamic.php
config:
application: 'statameet'
repository: 'git@github.com:jonassiewertsen/my-project-i-want-to-deploy.git'
# keep_releases: 3
shared_dirs:
# - public/img
# - .git
hosts:
live:
hostname: 'forge@your-ip-address'
deploy_path: '~/your-live-domain.com'
# branch: 'main'
tasks:
npm:production:
run: 'cd {{release_path}} && npm ci && npm run production'
deploy:
- 'deploy:prepare'
- 'deploy:vendors'
- 'npm:production'
- 'artisan:storage:link'
- 'artisan:optimize:clear'
# - 'statamic:static:clear'
- 'statamic:assets:generate-presets'
# - 'statamic:static:warm'
# - 'statamic:stache:warm'
- 'artisan:optimize'
- 'deploy:publish'
after:
deploy:failed: deploy:unlock
# # WIP and only beta tested for the Statamic git integration
# git:commit:
# run: 'cd {{previous_release}} && php please git:commit'
# git:update:
# run: 'cd {{release_path}} && git fetch origin deployment && git reset origin/deployment'
name: CI
on:
push:
branches: [ main ]
jobs:
deploy_live:
# if: "!contains(github.event.head_commit.message, '[BOT]')"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: 8.0
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
- name: Install dependencies
run: composer install --no-progress --no-interaction
- name: Deploy with Deployer
uses: deployphp/action@master
with:
private-key: ${{ secrets.PRIVATE_KEY }}
dep: deploy live -v
# Add to the SERVER scope
disable_symlinks off;
# Add to the LOCATION scope
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment