gadgets-sync: fix gitlab compatibility issues #151
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: Toolforge | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
concurrency: | |
group: tf-deploy | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: appleboy/ssh-action@551964ebda1034f0b5449d74db25c42e371ca1f7 | |
with: | |
script: >- | |
become sdzerobot bash -c ' | |
set -eo pipefail; | |
cd /data/project/sdzerobot/mwn; | |
if [[ "$(git pull --ff-only | grep -c "Already up to date")" -eq 0 ]]; then | |
if [[ "$(git diff --name-only HEAD HEAD@{1} | grep -c package.json)" -gt 0 ]]; then | |
echo "Running npm install for mwn ..."; | |
npm install; | |
fi; | |
echo "Building mwn ..."; | |
npm run build; | |
fi; | |
cd /data/project/sdzerobot/SDZeroBot; | |
echo "Pulling SDZeroBot ..."; | |
git checkout master; | |
git pull --ff-only; | |
if [[ "$(git diff --name-only HEAD HEAD@{1} | grep -c package.json)" -gt 0 ]]; then | |
echo "Running npm install for SDZeroBot ..."; | |
npm install; | |
fi; | |
echo "Building SDZeroBot ..."; | |
npm run tsc; | |
if [[ "$(git diff --name-only HEAD HEAD@{1} | grep -c crontab)" -gt 0 ]]; then | |
echo "Updating the crontab ..."; | |
crontab crontab; | |
fi; | |
if [[ "$(git diff --name-only HEAD HEAD@{1} | grep -c jobs.yml)" -gt 0 ]]; then | |
echo "Updating jobs.yml ..."; | |
toolforge jobs load jobs.yml; | |
fi; | |
if [[ "$(git diff --name-only HEAD HEAD@{1} | grep -c eventstream)" -gt 0 || "$(git rev-list --format=%B --max-count=1 HEAD)" == *"!restart"* ]]; then | |
echo "Restarting eventstream-router ..."; | |
cd eventstream-router && npm restart && cd -; | |
fi; | |
cp webservice/www-js-package.json /data/project/sdzerobot/www/js/package.json; | |
if [[ "$(git diff --name-only HEAD HEAD@{1} | grep -c "webservice/")" -gt 0 || "$(git diff --name-only HEAD HEAD@{1} | grep -c "web-endpoint")" -gt 0 || "$(git diff --name-only HEAD HEAD@{1} | grep -c "hbs")" -gt 0 || "$(git rev-list --format=%B --max-count=1 HEAD)" == *"!restart"* || "$(git rev-list --format=%B --max-count=1 HEAD)" == *"!web-restart"* ]]; then | |
echo "Restarting SDZeroBot webservice ..."; | |
cd /data/project/sdzerobot/SDZeroBot/webservice; | |
npm restart; | |
fi; | |
' | |
host: login.toolforge.org | |
username: sd | |
key: ${{ secrets.TOOLFORGE_PRIVATE_KEY }} |