Bringing NXP dev container up to date #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) .NET Foundation and Contributors | |
# See LICENSE file in the project root for full license information. | |
name: Build Dev Container for FreeRTOS-NXP | |
env: | |
CONTAINER_REPO: ghcr.io | |
CONTAINER_NAME: dev-container-freertos-nxp | |
CONTAINER_SRC_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**Dockerfile.FreeRTOS-NXP' | |
workflow_dispatch: | |
jobs: | |
build: | |
if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# when set to "true" but frees about 6 GB | |
tool-cache: true | |
large-packages: false | |
- name: Get container version | |
run: | | |
$dockerfileContent = Get-Content("${{ env.CONTAINER_SRC_FILE }}") | |
$dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' | |
$containerVersion = $Matches[0].ToString() | |
echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
shell: pwsh | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CONTAINER_BUILD_TOKEN }} | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
file: ${{ env.CONTAINER_SRC_FILE }} | |
push: true # Will only build if this is not here | |
tags: | | |
${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} | |
${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest |