Files
archtika/.github/workflows/deploy.yml
2024-10-26 23:12:56 +02:00

39 lines
1.1 KiB
YAML

name: Deploy to server
on:
workflow_run:
workflows: [ 'Playwright tests' ]
types: [ completed ]
branches: [ devel, main ]
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
environment: ${{ github.event.workflow_run.head_branch == 'devel' && 'qs' || 'prod' }}
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: ${{ secrets.SSH_KEY }}
known_hosts: ${{ vars.KNOWN_HOSTS }}
- name: Deploy to demo server
run: |
nix run nixpkgs#nixos-rebuild -- switch \
--flake .#${{ vars.FLAKE_CONFIGURATION_NAME }} \
--fast \
--build-host ${{ vars.SERVER_DEPLOY_USER }}@${{ vars.PUBLIC_SERVER_IP }} \
--target-host ${{ vars.SERVER_DEPLOY_USER }}@${{ vars.PUBLIC_SERVER_IP }} \
--use-remote-sudo