woodpecker-plugin-nix-attic/.woodpecker/ci.yaml
Gabor Pihaj a68dcbc4db
build: optimise pipeline runs (#7)
Reviewed-on: https://git.vdx.hu/voidcontext/woodpecker-plugin-nix-attic/pulls/7
Co-authored-by: Gabor Pihaj <gabor.pihaj@gmail.com>
Co-committed-by: Gabor Pihaj <gabor.pihaj@gmail.com>
2023-09-30 17:33:08 +00:00

46 lines
1.4 KiB
YAML

variables:
- common_settings: &common_settings
binary_cache: https://cache.nix.vdx.hu/private
binary_cache_public_key: private:b6wO7rXF+4WtPCocEKlbdU/bTqEdJAqRrzOu0O3cK68=
binary_cache_token:
from_secret: attic_token
when:
- event: pull_request
- event: push
branch: main
steps:
build:
when:
- event: pull_request
- event: push
branch: main
image: git.vdx.hu/voidcontext/woodpecker-plugin-nix-attic
settings:
<<: *common_settings
script: |
nix build .#woodpecker-plugin-nix-attic-latest
nix-env -iA nixpkgs.docker-client
# "persist" the generated image in the workspace
cp $(realpath result) docker-image-latest
docker load -i docker-image-latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
publish-latest:
image: git.vdx.hu/voidcontext/woodpecker-plugin-nix-attic
when:
- event: push
branch: main
settings:
<<: *common_settings
script: |
nix-env -iA nixpkgs.docker-client
# re-load persisted image (just in case...)
docker load -i docker-image-latest
docker login -u vdx -p "$FORGEJO_REGISTRY_TOKEN" git.vdx.hu
docker push git.vdx.hu/voidcontext/woodpecker-plugin-nix-attic
secrets:
- forgejo_registry_token
volumes:
- /var/run/docker.sock:/var/run/docker.sock