forked from nanoframework/nf-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (43 loc) · 1.44 KB
/
devcontainer-ti.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
name: Build Dev Container for TI
env:
GCR_IMAGE: ghcr.io/nanoframework/dev-container-ti
GCR_FILE: .devcontainer/sources/Dockerfile.TI
on:
push:
branches:
- main
paths:
- '**Dockerfile.TI'
workflow_dispatch:
jobs:
build:
if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Get container version
run: |
$dockerfileContent = Get-Content(".devcontainer/Dockerfile.TI")
$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@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CONTAINER_BUILD_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
file: ${{ env.GCR_FILE }}
push: true # Will only build if this is not here
tags: |
${{ env.GCR_IMAGE }}:${{ env.GCR_VERSION }}
${{ env.GCR_IMAGE }}:latest