mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
41 lines
1.5 KiB
YAML
41 lines
1.5 KiB
YAML
name: Deploy to server
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [ 'Playwright tests' ]
|
|
types: [ completed ]
|
|
branches: [ devel, main ]
|
|
env:
|
|
SERVER_USER: root
|
|
QS_SERVER_IP: 128.140.75.240
|
|
PROD_SERVER_IP: 116.203.122.75
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.workflow_run.head_branch }}
|
|
|
|
- name: Install Nix
|
|
uses: cachix/install-nix-action@v27
|
|
with:
|
|
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install SSH Key
|
|
uses: shimataro/ssh-key-action@v2
|
|
with:
|
|
key: ${{ github.event.workflow_run.head_branch == 'devel' && secrets.QS_SSH_KEY || secrets.PROD_SSH_KEY }}
|
|
known_hosts: ${{ github.event.workflow_run.head_branch == 'devel' && secrets.QS_KNOWN_HOSTS || secrets.PROD_KNOWN_HOSTS }}
|
|
|
|
- name: Deploy to demo server
|
|
run: |
|
|
nix run nixpkgs#nixos-rebuild -- switch \
|
|
--flake .#${{ github.event.workflow_run.head_branch == 'devel' && 'qs' || 'prod' }} \
|
|
--fast \
|
|
--build-host ${{ env.SERVER_USER }}@${{ github.event.workflow_run.head_branch == 'devel' && env.QS_SERVER_IP || env.PROD_SERVER_IP }} \
|
|
--target-host ${{ env.SERVER_USER }}@${{ github.event.workflow_run.head_branch == 'devel' && env.QS_SERVER_IP || env.PROD_SERVER_IP }} \
|
|
--use-remote-sudo
|