-
Notifications
You must be signed in to change notification settings - Fork 8
61 lines (57 loc) · 2.19 KB
/
deploy-app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Build and Deploy to production on Toolforge
on:
push:
branches:
- main
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/setup-node@v4.0.1
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-Production
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST_ALT }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
source: "./"
target: "mismatch-finder-repo"
rm: true
- name: Deploy code
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_ALT }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
command_timeout: 30m
script: |
# Make sure ~tools.mismatch-finder/mismatch-finder-repo is group writable
become mismatch-finder chmod -R g+rwx ~tools.mismatch-finder/mismatch-finder-repo
# Change group of ~/mismatch-finder-repo (including symlinks) to tools.mismatch-finder
chgrp --no-dereference -R tools.mismatch-finder ~/mismatch-finder-repo
rsync -rlgD --delete --delay-updates --exclude '.nfs*' --exclude .env --exclude storage/app/ ~/mismatch-finder-repo ~tools.mismatch-finder/
# 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/mismatch-finder-repo -type d,f \! -user tools.mismatch-finder -print0 | become mismatch-finder xargs -r --null take 2>&1 | { grep -vF 'will not follow or touch symlinks' || true; }