Skip to content

Commit 6cbd79a

Browse files
committed
Improve GH workflow
1 parent e681524 commit 6cbd79a

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.01
2-
LABEL website="nanoframework.net"
3-
LABEL desc="This is dockerfile image for NXP targets"
2+
LABEL org.website="https://nanoframework.net/"
3+
LABEL description="This is dockerfile image for NXP targets"

.github/workflows/devcontainer-freertos-nxp.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
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

66
env:
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

@@ -47,5 +54,6 @@ jobs:
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

Comments
 (0)