@@ -53,10 +53,15 @@ jobs:
5353 $repo = $env:GITHUB_REPOSITORY
5454 $tag = "nsc-godbolt-build-${{ matrix.vendor }}-${{ matrix.config }}-${{ matrix.tag }}"
5555 $nscTargetTaggedImage = "ghcr.io/${repo}:${tag}".ToLower()
56+ $nscTargetTaggedImageLatest = "ghcr.io/${repo}:nsc-godbolt-latest".ToLower()
57+
58+ $shouldPushImage = ("${{ github.ref }}" -eq "refs/heads/master" -and "${{ matrix.vendor }}" -eq "msvc")
5659
5760 "prefix=$prefix" >> $env:GITHUB_OUTPUT
5861 "nscTargetTaggedImage=$nscTargetTaggedImage" >> $env:GITHUB_OUTPUT
59-
62+ "nscTargetTaggedImageLatest=$nscTargetTaggedImageLatest" >> $env:GITHUB_OUTPUT
63+ "shouldPushImage=$shouldPushImage" >> $env:GITHUB_OUTPUT
64+
6065 - name : Checkout
6166 uses : actions/checkout@v4
6267 with :
@@ -137,6 +142,7 @@ jobs:
137142 with :
138143 name : ${{ steps.set-prefix.outputs.prefix }}-nsc-godbolt-image
139144 path : ${{ steps.set-prefix.outputs.prefix }}-nsc-godbolt-image.tar.zst
145+ compression-level : 0
140146
141147 - name : Upload profiling artifacts
142148 uses : actions/upload-artifact@v4
@@ -149,3 +155,17 @@ jobs:
149155 with :
150156 name : ${{ steps.set-prefix.outputs.prefix }}-install
151157 path : ${{ steps.set-prefix.outputs.prefix }}-install.tar
158+
159+ - name : Login to GHCR
160+ if : steps.set-prefix.outputs.shouldPushImage == 'True'
161+ run : echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u $env:GITHUB_ACTOR --password-stdin
162+
163+ - name : Tag Latest image
164+ if : steps.set-prefix.outputs.shouldPushImage == 'True'
165+ run : |
166+ docker tag ${{ steps.set-prefix.outputs.nscTargetTaggedImage }} ${{ steps.set-prefix.outputs.nscTargetTaggedImageLatest }}
167+
168+ - name : Push images to GHCR
169+ if : steps.set-prefix.outputs.shouldPushImage == 'True'
170+ run : |
171+ docker push ${{ steps.set-prefix.outputs.nscTargetTaggedImageLatest }}
0 commit comments