From cfbe0b71a94762a53aec20bf974a3f471d4c6e3e Mon Sep 17 00:00:00 2001 From: Patrick Cleavelin Date: Sat, 29 Jul 2023 14:30:52 -0500 Subject: [PATCH] no docker, only nix use correct tag just use docker instead of artifact save result of nix build in persistent volume --- .woodpecker.yml | 44 +++++++++++++++++--------------------------- flake.nix | 5 +++-- rust-toolchain | 2 +- 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index f1bae78..8214bae 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,31 +1,21 @@ steps: - # build: - # image: alpine:edge - # commands: - # - apk add --no-cache git nix --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing - # - nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#default - - # build-docker-image: - # image: alpine:edge - # commands: - # - apk add --no-cache git nix --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing - # - echo "system-features = nixos-test benchmark big-parallel uid-range kvm" > /etc/nix/nix.conf - # - nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#docker - build-docker-image: - image: docker + image: alpine:edge commands: - - docker build --rm -t . + - apk add --no-cache git nix --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing + - echo "system-features = nixos-test benchmark big-parallel uid-range kvm" > /etc/nix/nix.conf + - nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#docker + - cp $(nix build --extra-experimental-features nix-command --extra-experimental-features flakes --print-out-paths .#docker) ./memejoin-rs.tar.gz - # publish-image: - # when: - # event: [tag, deployment] - # environment: prod - # image: git.spacegirl.nl/patrick/plugin-artifact - # settings: - # tag: $CI_COMMIT_TAG - # user: patrick - # password: - # from_secret: forgejo_token - # repo: $CI_REPO - # image_tar: result + publish-image: + when: + event: tag + image: docker + secrets: [ forgejo_token ] + commands: + - docker login -u ${CI_REPO_OWNER} --password $FORGEJO_TOKEN git.spacegirl.nl + - docker image load --input memejoin-rs.tar.gz + - docker image tag memejoin-rs:${CI_COMMIT_TAG} git.spacegirl.nl/${CI_REPO}:${CI_COMMIT_TAG} + - docker image push git.spacegirl.nl/${CI_REPO}:${CI_COMMIT_TAG} + volumes: + - /var/run/docker.sock:/var/run/docker.sock diff --git a/flake.nix b/flake.nix index 3daab6c..1ebb90f 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,7 @@ outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: let + tag = "0.1.4_3-alpha"; overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; @@ -45,8 +46,8 @@ packages = with pkgs; flake-utils.lib.flattenTree rec { default = rustPlatform.buildRustPackage rec { + inherit tag; name = "memejoin-rs"; - version = "0.1.4_2-alpha"; src = self; buildInputs = [ openssl.dev ]; nativeBuildInputs = [ local-rust pkg-config openssl openssl.dev cmake gcc libopus ]; @@ -57,8 +58,8 @@ }; docker = dockerTools.buildImage { + inherit tag; name = "memejoin-rs"; - tag = "0.1.4_2-alpha"; copyToRoot = buildEnv { name = "image-root"; paths = [ default cacert openssl openssl.dev ffmpeg libopus youtube-dl yt-dlp ]; diff --git a/rust-toolchain b/rust-toolchain index 6f39b03..bf867e0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2023-07-27 +nightly