Skip to content

Commit

Permalink
feat: deploy docker image on release
Browse files Browse the repository at this point in the history
  • Loading branch information
frectonz committed Oct 19, 2024
1 parent 1f697ac commit 402f3aa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Docker Image

on:
push:
tags:
- '**[0-9]+.[0-9]+.[0-9]+*'

jobs:
build:
runs-on: ubuntu-24.04

permissions:
contents: read
id-token: write

env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}

steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Deploy Docker Image
run: nix run .#deploy
20 changes: 9 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,23 @@
'';
});

docker = pkgs.dockerTools.streamLayeredImage {
docker = pkgs.dockerTools.buildLayeredImage {
name = "sql-studio";
tag = "latest";
created = "now";
config.Cmd = [
"${bin}/bin/sql-studio"
"--no-browser"
"--no-shutdown"
"--address=0.0.0.0:3030"
"sqlite"
"preview"
];
config.Expose = "3030";
contents = [ bin ];
};

version = "0.1.28";
deploy = pkgs.writeShellScriptBin "deploy" ''
${pkgs.skopeo}/bin/skopeo --insecure-policy copy docker-archive:${docker} docker://docker.io/frectonz/sql-studio:${version} --dest-creds="frectonz:$ACCESS_TOKEN"
${pkgs.skopeo}/bin/skopeo --insecure-policy copy docker://docker.io/frectonz/sql-studio:${version} docker://docker.io/frectonz/sql-studio:latest --dest-creds="frectonz:$ACCESS_TOKEN"
'';
in
{
packages = {
inherit deploy docker;
default = bin;
docker = docker;
stable = pkgs.callPackage ./package.nix { };
};

Expand Down

0 comments on commit 402f3aa

Please sign in to comment.