11# Copyright (c) .NET Foundation and Contributors
22# See LICENSE file in the project root for full license information.
33
4- name : Push devcontainer Docker image [FreeRTOS-NXP]
4+ name : Push Docker image [FreeRTOS-NXP]
55
66env :
7+ CONTAINER_REPO : ghcr.io
8+ CONTAINER_NAME : dev-container-freertos-nxp
79 CONTAINER_SOURCE_FILE : .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC
810 CONTAINER_VERSION_FILE : .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP
911
@@ -28,17 +30,22 @@ jobs:
2830 - name : Checkout Repository
2931 uses : actions/checkout@v4
3032
31- - name : Extract metadata (tags, labels) for Docker
32- id : meta
33- uses : docker/metadata-action@v5
34- with :
35- images : ${{env.CONTAINER_VERSION_FILE}}
33+ - name : Get container version
34+ shell : pwsh
35+ run : |
36+ $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}")
37+ $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)'
38+ $containerVersion = $Matches[0].ToString()
39+ echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
40+
41+ - name : Set up Docker Buildx
42+ uses : docker/setup-buildx-action@v3
3643
3744 - name : Login to GitHub Container Registry
3845 if : ${{ github.event_name != 'pull_request' }}
3946 uses : docker/login-action@v3
4047 with :
41- registry : ghcr.io
48+ registry : ${{ env.CONTAINER_REPO }}
4249 username : ${{ github.repository_owner }}
4350 password : ${{ secrets.GITHUB_TOKEN }}
4451
4754 with :
4855 file : ${{ env.CONTAINER_SOURCE_FILE }}
4956 push : ${{ github.event_name != 'pull_request' }}
50- tags : ${{ steps.meta.outputs.tags }}
51- labels : ${{ steps.meta.outputs.labels }}
57+ tags : |
58+ ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }}
59+ ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest
0 commit comments