Skip to content

Update deploy-app-staging.yml #423

Update deploy-app-staging.yml

Update deploy-app-staging.yml #423

name: Build and Deploy to staging on Toolforge
on:
push:
branches:
- development
- staging/**
- gh-actions/**
concurrency:
group: '${{ github.workflow }}'
cancel-in-progress: true
jobs:
build-deploy:
name: Ship and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up node
uses: actions/[email protected]
with:
node-version: '18.x'
- name: Install composer dependencies
uses: php-actions/composer@v6
with:
dev: no
version: 2
php_version: 7.3
php_extensions: zip
- name: Installing node dependencies
run: npm ci
- name: Minify and Build CSS and JS
run: "npm run prod"
- name: Remove node_modules before syncing
run: "rm -rf node_modules"
- name: Syncing code to Toolforge-Staging
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
source: "./"
target: "mismatch-finder-repo-next"
rm: true
- name: Deploy code
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
script: |
# Make sure ~tools.mismatch-finder-staging/mismatch-finder-repo-next is group writable
become mismatch-finder-staging chmod -R g+rwx ~tools.mismatch-finder-staging/mismatch-finder-repo-next
# Change group of ~/mismatch-finder-repo-next (including symlinks) to tools.mismatch-finder-staging
chgrp --no-dereference -R tools.mismatch-finder-staging ~/mismatch-finder-repo-next
rsync -rlgD --delete --delay-updates --exclude '.nfs*' --exclude .env --exclude storage/app/ ~/mismatch-finder-repo-next ~tools.mismatch-finder-staging/
# take aborts recursion whenever it encounters a symlink, thus we use find+xargs to make sure all folders and file ares handled.
find ~tools.mismatch-finder-staging/mismatch-finder-repo-next -type d,f \! -user tools.mismatch-finder-staging -print0 | become mismatch-finder-staging xargs -r --null take 2>&1 | { grep -vF 'will not follow or touch symlinks' || true; }