-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: build and publish exposed docker package
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |