This commit is contained in:
@@ -1,4 +1,9 @@
|
|||||||
name: Deploy Hashel
|
# Required Gitea Actions secrets:
|
||||||
|
# SSH_PRIVATE_KEY - Private key for SSH authentication
|
||||||
|
# DEPLOY_HOST - Target server IP address (e.g. 144.217.160.198)
|
||||||
|
# DEPLOY_USER - SSH user on the target server (e.g. root)
|
||||||
|
|
||||||
|
name: Deploy Haschel
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -9,16 +14,6 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Nix
|
|
||||||
uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
sandbox = false
|
|
||||||
|
|
||||||
- name: Configure SSH
|
- name: Configure SSH
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
@@ -27,12 +22,14 @@ jobs:
|
|||||||
cat >> ~/.ssh/config << EOF
|
cat >> ~/.ssh/config << EOF
|
||||||
Host haschel
|
Host haschel
|
||||||
HostName ${{ secrets.DEPLOY_HOST }}
|
HostName ${{ secrets.DEPLOY_HOST }}
|
||||||
|
User ${{ secrets.DEPLOY_USER }}
|
||||||
StrictHostKeyChecking no
|
StrictHostKeyChecking no
|
||||||
UserKnownHostsFile /dev/null
|
UserKnownHostsFile /dev/null
|
||||||
IdentityFile ~/.ssh/id_ed25519
|
IdentityFile ~/.ssh/id_ed25519
|
||||||
EOF
|
EOF
|
||||||
chmod 600 ~/.ssh/config
|
chmod 600 ~/.ssh/config
|
||||||
|
|
||||||
- name: Deploy with deploy-rs
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
nix run github:serokell/deploy-rs -- .#haschel --skip-checks --remote-build
|
REPO_URL="${{ github.server_url }}/${{ github.repository }}.git"
|
||||||
|
ssh haschel "rm -rf /tmp/nixos-config && git clone $REPO_URL /tmp/nixos-config && nixos-rebuild switch --flake /tmp/nixos-config#haschel && rm -rf /tmp/nixos-config"
|
||||||
|
|||||||
14
flake.nix
14
flake.nix
@@ -3,10 +3,9 @@
|
|||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||||
deploy-rs.url = "github:serokell/deploy-rs";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, deploy-rs, ... }@inputs:
|
outputs = { self, nixpkgs, ... }@inputs:
|
||||||
let
|
let
|
||||||
settings = import ./settings.nix;
|
settings = import ./settings.nix;
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
@@ -18,16 +17,5 @@
|
|||||||
./configuration.nix
|
./configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
deploy.nodes."${settings.hostname}" = {
|
|
||||||
hostname = "haschel";
|
|
||||||
sshUser = "root";
|
|
||||||
profiles.system = {
|
|
||||||
user = "root";
|
|
||||||
path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations."${settings.hostname}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user