woodpecker-plugin-nix-attic/.woodpecker/ci.yaml
Gabor Pihaj 2ae1bb82d4
build: build and publish from CI pipeline (#1)
Reviewed-on: https://git.vdx.hu/voidcontext/woodpecker-plugin-nix-attic/pulls/1
Co-authored-by: Gabor Pihaj <gabor.pihaj@gmail.com>
Co-committed-by: Gabor Pihaj <gabor.pihaj@gmail.com>
2023-09-30 14:11:00 +00:00

45 lines
2 KiB
YAML

steps:
build:
image: nixos/nix:2.15.1
commands:
- set -o pipefail
- echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
- echo "trusted-substituters = https://cache.nix.vdx.hu/private" >> /etc/nix/nix.conf
- echo "extra-trusted-public-keys = private:b6wO7rXF+4WtPCocEKlbdU/bTqEdJAqRrzOu0O3cK68=" >> /etc/nix/nix.conf
- echo "extra-substituters = https://cache.nix.vdx.hu/private" >> /etc/nix/nix.conf
- echo "netrc-file = /tmp/nix-netrc" >> /etc/nix/nix.conf
- echo "machine cache.nix.vdx.hu" > /tmp/nix-netrc
- echo "password $ATTIC_TOKEN" >> /tmp/nix-netrc
- 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
secrets:
- attic_token
- forgejo_registry_token
volumes:
- /var/run/docker.sock:/var/run/docker.sock
publish-latest:
image: nixos/nix
when:
- event: push
branch: main
commands:
- set -o pipefail
- echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
- echo "trusted-substituters = https://cache.nix.vdx.hu/private" >> /etc/nix/nix.conf
- echo "extra-trusted-public-keys = private:b6wO7rXF+4WtPCocEKlbdU/bTqEdJAqRrzOu0O3cK68=" >> /etc/nix/nix.conf
- echo "extra-substituters = https://cache.nix.vdx.hu/private" >> /etc/nix/nix.conf
- echo "netrc-file = /tmp/nix-netrc" >> /etc/nix/nix.conf
- echo "machine cache.nix.vdx.hu" > /tmp/nix-netrc
- echo "password $ATTIC_TOKEN" >> /tmp/nix-netrc
- nix-env -iA nixpkgs.docker-client
- 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:
- attic_token
- forgejo_registry_token
volumes:
- /var/run/docker.sock:/var/run/docker.sock