From 0df50073d5389166166e98c06ee59e3c7020ecb5 Mon Sep 17 00:00:00 2001 From: Ashhhleyyy Date: Sat, 17 Feb 2024 23:33:55 +0000 Subject: [PATCH] feat(ci): lets see if i've written a workflow correctly first time (doubt it lol) --- .forgejo/workflows/publish.yml | 30 ++++++++++++++++++++++++++++++ flake.nix | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .forgejo/workflows/publish.yml diff --git a/.forgejo/workflows/publish.yml b/.forgejo/workflows/publish.yml new file mode 100644 index 0000000..29eecb9 --- /dev/null +++ b/.forgejo/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish docker image + +on: + push: + branches: ['main'] + +jobs: + publish: + name: Publish + runs-on: docker + + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install nix + uses: https://github.com/cachix/install-nix-action@v25 + - name: Build image + run: "nix --extra-experimental-features 'nix-command,flakes' build .#docker" + - name: Load image + run: "docker load < result" + - name: Retag image + run: "docker image tag aci-backend:latest git.ashhhleyyy.dev/ash/aci:latest && docker image tag aci-backend:latest git.ashhhleyyy.dev/ash/aci:${{github.sha}}" + - name: Log in to registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Push images + run: "docker push git.ashhhleyyy.dev/ash/aci:latest git.ashhhleyyy.dev:${{github.sha}}" diff --git a/flake.nix b/flake.nix index 604b2d0..d338329 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ docker = pkgs.dockerTools.buildLayeredImage { name = self.packages.${system}.default.pname; - tag = version; + tag = "latest"; contents = [ self.packages.${system}.default pkgs.busybox ]; config = { Cmd = [ "/bin/app.py" ];