build_homelab_yaml #16
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_homelab_yaml" | |
on: | |
workflow_dispatch: | |
# push: | |
# branches: | |
# - main | |
jobs: | |
build_homelab_yaml: | |
runs-on: ubuntu-latest | |
steps: | |
- name: install nix | |
uses: cachix/install-nix-action@v30 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
- name: checkout main | |
uses: actions/checkout@v4 | |
- name: build homelab | |
uses: arnarg/nixidy/actions/build@main | |
id: build | |
with: | |
environment: .#homelab | |
- name: checkout homelab | |
uses: actions/checkout@v4 | |
with: | |
ref: homelab | |
path: ./homelab | |
- name: remove files | |
working-directory: ./homelab | |
run: | | |
pwd | |
touch content-to-enable-rm-on-empty-dir | |
echo "remove files:" | |
echo `ls -a | grep -v "^.$\|^..$\|^.git$\|^.gitignore$"` | |
rm -r `ls -a | grep -v "^.$\|^..$\|^.git$\|^.gitignore$"` | |
- name: copy build | |
run: | | |
echo ${{ steps.build.outputs.out-path }} | |
rsync --copy-links --copy-dirlinks --recursive '${{steps.build.outputs.out-path}}/' homelab | |
- name: commit and push changes | |
working-directory: ./homelab | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add --all | |
git commit -m 'update homelab configuration' | |
git push origin homelab |