dev: docker compose #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-js-production: | |
name: Build JavaScript/CSS for Production Server | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@main | |
with: | |
php-version: '8.3' | |
extension-csv: mbstring, bcmath | |
- name: Composer install | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: NPM Build | |
run: | | |
composer install | |
npm install | |
npm run build | |
- name: Put built assets in Artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: assets | |
path: public | |
retention-days: 3 | |
deploy-production: | |
name: Deploy Project to Production Server | |
runs-on: ubuntu-latest | |
needs: [ build-js-production ] | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Fetch built assets from Artifacts | |
uses: actions/download-artifact@v1 | |
with: | |
name: assets | |
path: public | |
- name: Setup PHP | |
uses: shivammathur/setup-php@main | |
with: | |
php-version: '8.3' | |
extension-csv: mbstring, bcmath | |
- name: Composer install | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Setup Deployer | |
uses: atymic/deployer-php-action@master | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }} | |
- name: Deploy to Production | |
env: | |
DOT_ENV: ${{ secrets.DOT_ENV_PRODUCTION }} | |
run: php vendor/bin/dep deploy production branch=main -vvv |