Skip to content

Instantly share code, notes, and snippets.

@sjelfull
Forked from Mosnar/staging.yml
Created April 8, 2020 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjelfull/63d37147f515493ecb89b34f2e575dc3 to your computer and use it in GitHub Desktop.
Save sjelfull/63d37147f515493ecb89b34f2e575dc3 to your computer and use it in GitHub Desktop.
Craft CMS & Webpack on Laravel Forge
name: Deploy to Staging
on:
push:
branches: [ develop ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Frontend Dependencies
run: npm install
- name: Build for production
run: npm run prod
- name: Upload Artifact
uses: actions/upload-artifact@v2-preview
with:
name: web
path: web
deployfrontend:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download web
uses: actions/download-artifact@v1
with:
name: web
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.STAGING_SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.STAGING_KNOWN_HOSTS }}
- name: RSync
run: rsync -avh --delete --exclude cpresources ./web/ ${{ secrets.STAGING_SFTP_SERVER }}:${{ secrets.STAGING_SFTP_PATH }}/web/
deploybackend:
needs: deployfrontend
runs-on: ubuntu-latest
steps:
- name: Trigger Deploy
run: curl -X POST -o - ${{ secrets.STAGING_WEBHOOK_URL }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment