Define hydra
, mercury
and strudel
globals on parent Window to s…
#15
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: Build and Deploy to flok.cc | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- run: npm install | |
- run: npm run build | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/prod.key | |
chmod 600 ~/.ssh/prod.key | |
cat >>~/.ssh/config <<END | |
Host prod | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/prod.key | |
StrictHostKeyChecking no | |
END | |
env: | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_KEY: ${{ secrets.SSH_KEY }} | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
- name: Update remote repository and install dependencies | |
run: ssh prod 'cd flok && git fetch && git reset --hard ${{ github.sha }} && npm install' | |
- name: Sync web build | |
uses: burnett01/[email protected] | |
with: | |
switches: -avzr --delete | |
path: packages/web/dist/ | |
remote_path: flok/packages/web/dist/ | |
remote_host: ${{ secrets.SSH_HOST }} | |
remote_user: ${{ secrets.SSH_USER }} | |
remote_key: ${{ secrets.SSH_KEY }} | |
- name: Restart server | |
run: ssh prod 'sudo systemctl restart flok && sleep 5 && sudo systemctl status flok' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true |