Last active
April 8, 2020 15:44
-
-
Save Mosnar/574314863140a00e9432e36f3106209b to your computer and use it in GitHub Desktop.
Craft CMS & Webpack on Laravel Forge
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
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