Skip to content

Commit d11b9fb

Browse files
author
Kutu
committed
Add final Docker workflow
1 parent 6d656e3 commit d11b9fb

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

.github/workflows/check.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14+
1415
- uses: cachix/install-nix-action@v27
1516
with:
1617
github_access_token: ${{ secrets.GITHUB_TOKEN }}
18+
- uses: DeterminateSystems/magic-nix-cache-action@main
19+
1720
- uses: nicknovitski/nix-develop@v1
1821
- run: just setup
1922
- run: just check

.github/workflows/docker.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: "Publish to the GitHub Container registry"
22

3-
env:
4-
REGISTRY: ghcr.io
5-
63
on:
74
workflow_dispatch:
85
push:
@@ -25,15 +22,16 @@ jobs:
2522
- uses: cachix/install-nix-action@v27
2623
with:
2724
github_access_token: ${{ secrets.GITHUB_TOKEN }}
25+
- uses: DeterminateSystems/magic-nix-cache-action@main
26+
2827
- uses: nicknovitski/nix-develop@v1
2928

30-
- run: just build-docker-image ${{ github.ref_name }}
31-
3229
- name: Log in to the Container registry
33-
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
30+
uses: docker/login-action@v3
3431
with:
35-
registry: ${{ env.REGISTRY }}
32+
registry: ghcr.io
3633
username: ${{ github.actor }}
3734
password: ${{ secrets.GITHUB_TOKEN }}
3835

39-
- run: docker push ${{ env.REGISTRY }}/kutu-dev/documentation
36+
- run: just build-docker-image "${{ github.ref_name }}"
37+
- run: just publish-docker-image "${{ github.ref_name }}"

justfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ new-project project_name:
106106
# Build the Docker image of a project given a git tag. Mostly used in the CI/CD
107107
[script]
108108
build-docker-image tag:
109-
let project = ("documentation/0.0.1" | parse "{project}/{version}" | reject version).0.project
109+
let tag = ({{tag}} | parse "{project}/{version}").0
110110

111-
just -f $"./projects/($project)/justfile" build-docker-image
111+
just -f $"./projects/($tag.project)/justfile" build-docker-image $tag.version
112+
113+
# Publish to ghcr.io the Docker image of a project given a git tag. Mostly used in the CI/CD
114+
[script]
115+
publish-docker-image tag:
116+
let tag = ({{tag}} | parse "{project}/{version}").0
117+
118+
docker push $"ghcr.io/kutu-dev/($tag.project):($tag.version)"

projects/documentation/justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ serve: generate-indices
5151

5252
# Build the Docker image of the documentation. Mostly used in the CI/CD
5353
[script]
54-
build-docker-image:
54+
build-docker-image tag:
5555
cd ../..
5656

57-
docker build -t ghcr.io/kutu-dev/documentation -f projects/documentation/Dockerfile .
57+
docker build -t ghcr.io/kutu-dev/documentation:{{tag}} -f projects/documentation/Dockerfile .

0 commit comments

Comments
 (0)