File tree Expand file tree Collapse file tree 3 files changed +34
-12
lines changed
Expand file tree Collapse file tree 3 files changed +34
-12
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,13 @@ jobs:
1919 publish :
2020 runs-on : ubuntu-22.04
2121 steps :
22- - name : Extract metadata for Docker
23- if : github.event_name == 'push' && contains(github.ref, 'refs/tags/')
24- id : meta
25- uses : docker/metadata-action@v5
26- with :
27- images : |
28- codingteam/emulsion
29- tags : |
30- type=ref,event=branch
22+ - name : Clone the repository
23+ uses : actions/checkout@v4
24+
25+ - name : Read version from ref
26+ id : version
27+ shell : pwsh
28+ run : echo "version=$(./Scripts/Get-Version.ps1 -RefName $env:GITHUB_REF)" >> $env:GITHUB_OUTPUT
3129
3230 - name : Login to Docker Hub
3331 if : github.event_name == 'push' && contains(github.ref, 'refs/tags/')
3937 - name : Build and Push Docker Images
4038 uses : docker/build-push-action@v6
4139 with :
42- tags : |
43- ${{ steps.meta.outputs.tags }}
44- codingteam/emulsion:latest
40+ tags : codingteam/emulsion:latest,codingteam/emulsion:v${{ steps.version.outputs.version }}
4541 push : ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') && 'true' || 'false' }}
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ EndProject
6868Project ("{2150E333-8FDC-42A3-9474-1A3956D46DE8}" ) = "scripts" , "scripts" , "{E3091B22-752A-4260-B4F3-903B9043479F}"
6969 Project Section (SolutionItems ) = preProject
7070 scripts \Test -Encoding .ps1 = scripts \Test -Encoding .ps1
71+ scripts \Get -Version .ps1 = scripts \Get -Version .ps1
7172 EndProject Section
7273EndProject
7374Project ("{2150E333-8FDC-42A3-9474-1A3956D46DE8}" ) = "LICENSES" , "LICENSES" , "{BBA60ACE-9FB4-4F3B-89EC-16A5BB9F5686}"
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2024 Friedrich von Never <friedrich@fornever.me>
2+ #
3+ # SPDX-License-Identifier: MIT
4+
5+ param (
6+ [string ] $RefName ,
7+ [string ] $RepositoryRoot = " $PSScriptRoot /.." ,
8+
9+ $ProjectFile = " $RepositoryRoot /Emulsion/Emulsion.fsproj"
10+ )
11+
12+ $ErrorActionPreference = ' Stop'
13+ Set-StrictMode - Version Latest
14+
15+ Write-Host " Determining version from ref `" $RefName `" …"
16+ if ($RefName -match ' ^refs/tags/v' ) {
17+ $version = $RefName -replace ' ^refs/tags/v' , ' '
18+ Write-Host " Pushed ref is a version tag, version: $version "
19+ } else {
20+ [xml ] $props = Get-Content $ProjectFile
21+ $version = $props.Project.PropertyGroup.Version
22+ Write-Host " Pushed ref is a not version tag, get version from $ ( $ProjectFile ) : $version "
23+ }
24+
25+ Write-Output $version
You can’t perform that action at this time.
0 commit comments