Created
March 12, 2021 13:01
-
-
Save dmatthams/ec2909ec50c149e28e02f2320fd6c5f4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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-production | |
| on: | |
| release: | |
| types: [ published ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Composer - Get directory | |
| id: composer-cache-dir | |
| run: | | |
| echo "::set-output name=dir::$(composer config cache-files-dir)" | |
| - name: Composer - Cache | |
| uses: actions/cache@v2 | |
| id: composer-cache | |
| with: | |
| path: ${{ steps.composer-cache-dir.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: NPM - Cache | |
| id: npm-cache | |
| uses: actions/cache@v2 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| - name: Composer - Install | |
| working-directory: ./ | |
| run: | | |
| composer clearcache | |
| composer install --no-interaction | |
| - name: NPM - Install | |
| run: npm install | |
| - name: NPM - Build | |
| run: npm run production | |
| - name: rsync deployments | |
| uses: burnett01/[email protected] | |
| with: | |
| switches: -avzr --delete --exclude-from "rsync.exclude.txt" | |
| remote_path: ${{secrets.FOLDER}} | |
| remote_host: ${{secrets.HOST}} | |
| remote_port: ${{ secrets.PORT }} | |
| remote_user: ${{ secrets.USER }} | |
| remote_key: ${{ secrets.SSH_KEY }} | |
| - name: Post deploy setup | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USER }} | |
| key: ${{ secrets.SSH_KEY }} | |
| port: ${{ secrets.PORT }} | |
| script: | | |
| cd ${{secrets.FOLDER}} | |
| craft backup/db | |
| craft migrate/all --interactive=0 | |
| craft project-config/apply --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment