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 3599cef
Showing 1 changed file with 56 additions and 0 deletions.
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"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

on:
pull_request:
branches:
- main
workflow_dispatch:
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
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Log into ghcr
uses: docker/login-action@master
with:
registry: "${{ env.REGISTRY }}"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: Build Exposed Docker Image
run: nix build .#docker-nix --print-build-logs

- name: Publish Docker Image
run: |
#!/usr/bin/env bash
set -eu
docker login "${{ env.REGISTRY }}" --username "${{ github.actor}}" --password "${{ secrets.GITHUB_TOKEN}}"
# load the built image
docker load -i result &&
# publish the loaded image
docker push neovim-flake-nix:latest

0 comments on commit 3599cef

Please sign in to comment.