Skip to content

Commit

Permalink
CI: build and publish exposed docker package
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Oct 23, 2023
1 parent 09e60b6 commit 7cb670a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
56 changes: 56 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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 & Tag Built Docker Image
run: |
docker load -i result ; docker images
docker tag localhost/neovim-flake:latest notashelf/neovim-flake:latest
- name: Log into DockerHub
uses: docker/login-action@master
with:
username: notashelf
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Push to DockerHub
run: docker push notashelf/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
2 changes: 1 addition & 1 deletion flake/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
inherit (config.legacyPackages) neovim-nix;
in
dockerTools.buildImage {
name = "neovim-flake-nix";
name = "neovim-flake";
tag = "latest";

copyToRoot = buildEnv {
Expand Down

0 comments on commit 7cb670a

Please sign in to comment.