File tree 2 files changed +42
-1
lines changed
2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Create SemVer-tagged OCI image
3
+ on :
4
+ push :
5
+ tags :
6
+ - ' *'
7
+
8
+ permissions : read-all
9
+
10
+ jobs :
11
+ publish-image :
12
+ runs-on : ubuntu-22.04
13
+ permissions :
14
+ packages : write
15
+ id-token : write
16
+ steps :
17
+
18
+ - name : Checkout
19
+ uses : >- # v4.1.1
20
+ actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
21
+
22
+ - name : Install Nix
23
+ uses : >- # v7
24
+ DeterminateSystems/nix-installer-action@5620eb4af6b562c53e4d4628c0b6e4f9d9ae8612
25
+ with :
26
+ github-token : ${{ secrets.GITHUB_TOKEN }}
27
+
28
+ - name : Test image
29
+ run : |
30
+ nix run .#local-image-test
31
+
32
+ - name : Upload image
33
+ run : |
34
+ nix run .#publish-ghcr ${{github.ref_name}}
35
+ env :
36
+ GHCR_REGISTRY : ghcr.io
37
+ GHCR_USERNAME : ${{ github.actor }}
38
+ GHCR_PASSWORD : ${{ secrets.GITHUB_TOKEN }}
39
+ GHCR_IMAGE_NAME : ${{ github.repository }}
Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ pkgs.writeShellScriptBin "publish-ghcr" ''
13
13
# nothing would still lead to a new hash. Instead we use the
14
14
# derivation hash as the tag so that the tag is reused if the image
15
15
# didn't change.
16
- IMAGE_TAG=$(nix eval .#image.imageTag --raw)
16
+ #
17
+ # If a positional argument is passed it overrides the tag value.
18
+ IMAGE_TAG='' ${1:-$(nix eval .#image.imageTag --raw)}
17
19
18
20
TAGGED_IMAGE='' ${GHCR_REGISTRY}/'' ${GHCR_IMAGE_NAME,,}:'' ${IMAGE_TAG}
19
21
You can’t perform that action at this time.
0 commit comments