mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 10:51:36 +01:00
48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
name: Deploy to server
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [ 'Playwright tests' ]
|
|
types: [ completed ]
|
|
branches: [ devel, main ]
|
|
|
|
jobs:
|
|
environment-check:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
|
|
outputs:
|
|
env_name: ${{ github.event.workflow_run.head_branch == 'devel' && 'qs' || 'prod' }}
|
|
steps:
|
|
- run: echo "Determining environment..."
|
|
|
|
deploy:
|
|
needs: environment-check
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: ${{ needs.environment-check.outputs.env_name }}
|
|
|
|
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
|