Deploy to Toolforge #181
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: Deploy to Toolforge | |
on: | |
push: | |
tags: | |
- v0.* | |
schedule: | |
- cron: '30 12 * * MON' | |
jobs: | |
deploy-toolforge: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 8 | |
- name: Install & Build | |
run: | | |
pnpm install --frozen-lockfile | |
pnpm run build | |
- name: Copy build file to production env | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
host: login.toolforge.org | |
username: ${{ secrets.TOOLFORGE_USERNAME }} | |
key: ${{ secrets.TOOLFORGE_KEY }} | |
source: './dist' | |
target: '~/.' | |
- name: Deploy | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: login.toolforge.org | |
username: ${{ secrets.TOOLFORGE_USERNAME }} | |
key: ${{ secrets.TOOLFORGE_KEY }} | |
script: | | |
xargs rm -r < /data/project/wscd/purge_list.txt && | |
rm /data/project/wscd/purge_list.txt && | |
pushd dist && | |
printf '/data/project/wscd/public_html/%s\n' * > /data/project/wscd/purge_list.txt && | |
popd && | |
cp -r ~/dist/. /data/project/wscd/public_html && | |
rm -rf ~/dist && | |
become wscd bash -c "take purge_list.txt public_html && chmod -R g+w purge_list.txt public_html" |