Trigger Build #42
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: CI-CD | |
| on: | |
| push: | |
| branches: [master] | |
| jobs: | |
| build: | |
| name: Build JS/CSS | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/setup-node@v2 | |
| with: | |
| node-version: '16' | |
| - name: NPM Build | |
| run: | | |
| npm ci | |
| npm run prod | |
| cat public/mix-manifest.json | |
| - name: Upload build files | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: assets | |
| path: | | |
| public/mix-manifest.json | |
| public/js/ | |
| public/css/ | |
| # FIXME: add test-php? | |
| deploy: | |
| name: Deploy to SRCF | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| environment: production | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Download build assets | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: assets | |
| path: public | |
| # TODO: version-independent PHP setup? | |
| - run: composer install | |
| - name: Deploy | |
| # FIXME: Keep up to date | |
| uses: deployphp/action@v1 | |
| with: | |
| private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }} | |
| dep: deploy | |
| env: | |
| DOT_ENV: ${{ secrets.DOT_ENV }} | |
| SRCF_USER: ${{ secrets.SRCF_USER }} |