Add a pull request template, too #1
Workflow file for this run
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: Test and deploy | |
on: push | |
jobs: | |
deploy: | |
name: Lint, Test and Deploy | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.0' | |
tools: composer:v2 | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer packages | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | |
restore-keys: ${{ runner.os }}-php- | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm install | |
- name: Lint | |
run: npm run lint | |
- name: Setup tests | |
run: mkdir uploads | |
- name: Test | |
run: npm run test | |
- name: Setup SSH deploy key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.DEPLOY_SSH_KEY }} | |
known_hosts: github.com | |
- name: Setup Git credentials | |
run: | | |
git config --global user.name "XWP Deploy Bot" | |
git config --global user.email "technology@xwp.co" | |
- name: Deploy to develop | |
if: github.ref_name == 'develop' | |
run: npm run deploy-staging | |
- name: Deploy to production | |
if: github.ref_name == 'main' | |
run: npm run deploy-production |