Adding action to add nix capabilities to docker runner #2

Open
eoghanconlon73 wants to merge 20 commits from eoghanconlon73/actions:main into main
4 changed files with 61 additions and 1 deletions

View file

@ -104,3 +104,25 @@ jobs:
folder: "src"
#destination: "subfolder"
```
## Docker Nix
This action is used to get nix into the docker user deploy system.
### v7
```yaml
jobs:
build:
runs-on: docker
steps:
uses: https://forgejo.skynet.ie/Skynet/actions/docker_nix@v7
```
## Nix build Deploy user
This action can build your website if you develop it using different methods than writing HTML. Only pre-requisite is that
this action uses the Nix build command, so your repository requires a nix flake.
```yaml
jobs:
build:
runs-on: docker
steps:
uses: https://forgejo.skynet.ie/Skynet/actions/nix-build_deploy@v7
```

View file

@ -23,4 +23,4 @@ ssh ${USERNAME}@skynet.skynet.ie "mkdir -p ~/public_html && chmod 711 ~ || true
ssh ${USERNAME}@skynet.skynet.ie "mkdir -p ~/public_html/${DESTINATION}"
# copy files across
scp -r ${FOLDER}/* ${USERNAME}@skynet.skynet.ie:/home/${USERNAME}/public_html/${DESTINATION}
scp -rL ${FOLDER}/* ${USERNAME}@skynet.skynet.ie:/home/${USERNAME}/public_html/${DESTINATION}

19
docker_nix/action.yml Normal file
View file

@ -0,0 +1,19 @@
name: 'Get image ready to run nix jobs'
description: 'Update apt repositories and installing sudo'
runs:
using: 'composite'
steps:
- name: 'Installing nix on Docker runner'
shell: bash
run: |
apt update
apt upgrade -y
apt install -y sudo
- uses: https://github.com/cachix/install-nix-action@v29
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
trusted-public-keys = skynet-cache:zMFLzcRZPhUpjXUy8SF8Cf7KGAZwo98SKrzeXvdWABo= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://nix-cache.skynet.ie/skynet-cache https://hydra.iohk.io https://cache.nixos.org/
- shell: bash
run: nix --version

View file

@ -0,0 +1,19 @@
name: "Deploying from a Nix Build"
description: "Deploys a website when built from a nix flake"
runs:
using: 'composite'
steps:
- uses: https://forgejo.skynet.ie/eoghanconlon73/actions/docker_nix@eoghan_test-final3
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: https://forgejo.skynet.ie/Skynet/actions/get_lfs@v6
with:
repository: ${{ gitea.repository }}
ref_name: ${{ gitea.ref_name }}
- run: nix build
- run: mkdir temp
- run: cp -rL result/* ./temp
- uses: https://forgejo.skynet.ie/Skynet/actions/deploy_user@v6
with:
ssh_key: ${{ secrets.SSH_KEY }}
username: ${{ env.GITHUB_REPOSITORY_OWNER }}
folder: "result"