From d40bd33e0ee59c23497326961672556d942835b1 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 22 Oct 2023 00:45:54 +0300 Subject: [PATCH] CI: build and publish exposed docker package --- .github/workflows/docker.yml | 54 ++++++++++++++++++++++++++++++++++++ flake/packages.nix | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..0f7019a03 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,54 @@ +name: "Publish Docker Image" +on: + workflow_dispatch: + pull_request: + branches: + - main + push: + branches: + - main + tags: + - "v*" # only publish tagged releases + +jobs: + build-docker-image: + name: "Build Docker Image" + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + - name: Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@main + + - name: Build Exposed Docker Image + run: nix build .#docker-nix --print-build-logs + + - name: Load Built Docker Image + run: docker load -i result + + - name: Log into DockerHub + uses: docker/login-action@master + with: + username: notashelf + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + + - name: Push to DockerHub + run: docker push neovim-flake:latest + + - name: Log into ghcr + uses: docker/login-action@master + with: + registry: "ghcr.io" + username: "${{ github.actor }}" + password: "${{ secrets.GITHUB_TOKEN }}" + + - name: Publish Docker Image (Github Packages) + run: docker push ghcr.io/neovim-flake:latest diff --git a/flake/packages.nix b/flake/packages.nix index cb46e744f..68ce51b54 100644 --- a/flake/packages.nix +++ b/flake/packages.nix @@ -36,7 +36,7 @@ inherit (config.legacyPackages) neovim-nix; in dockerTools.buildImage { - name = "neovim-flake-nix"; + name = "neovim-flake"; tag = "latest"; copyToRoot = buildEnv {