File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ name : release
2+ on :
3+ push :
4+ tags :
5+ - " [0-9]+.[0-9]+.[0-9]+"
6+ jobs :
7+ create-container-release :
8+ name : create-container-release
9+ runs-on : ubuntu-latest
10+ steps :
11+ - uses : actions/checkout@v3
12+ - uses : DeterminateSystems/nix-installer-action@main
13+ - uses : DeterminateSystems/magic-nix-cache-action@main
14+ - name : Push Image
15+ run : nix run ".#publish-container-release"
16+ env :
17+ GH_USERNAME : ${{ github.actor }}
18+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1414 pkgs = import nixpkgs { inherit system ; } ;
1515 python = pkgs . python311 . withPackages
1616 ( ps : [ ps . openstacksdk ps . prometheus-client ps . pyyaml ] ) ;
17+
18+ info = builtins . fromTOML ( builtins . readFile ./pyproject.toml ) ;
19+
1720 container-name = "ghcr.io/tristancacqueray/zuul-capacity" ;
1821 container = pkgs . dockerTools . streamLayeredImage {
1922 name = container-name ;
2730 } ;
2831 } ;
2932
33+ publish-container-release =
34+ pkgs . writeShellScriptBin "container-release" ''
35+ set -e
36+ export PATH=$PATH:${ pkgs . gzip } /bin:${ pkgs . skopeo } /bin
37+ IMAGE="docker://${ container-name } "
38+
39+ echo "Logging to registry..."
40+ echo $GH_TOKEN | skopeo login --username $GH_USERNAME --password-stdin ghcr.io
41+
42+ echo "Building and publishing the image..."
43+ ${ container } | gzip --fast | skopeo copy docker-archive:/dev/stdin $IMAGE:${ info . project . version }
44+
45+ echo "Tagging latest"
46+ skopeo copy $IMAGE:${ info . project . version } $IMAGE:latest
47+ '' ;
48+
3049 in {
3150 packages . container = container ;
51+ apps . publish-container-release =
52+ flake-utils . lib . mkApp { drv = publish-container-release ; } ;
3253 devShell = pkgs . mkShell { buildInputs = with pkgs ; [ uv ] ; } ;
3354 } ) ;
3455}
You can’t perform that action at this time.
0 commit comments