55 workflow_dispatch :
66 inputs :
77 ref_name :
8- description : " name of git ref for which to build installer "
8+ description : " the ref (tag/branch) to use to extract tag/version "
99 required : true
1010 type : string
1111 workflow_call :
1212 inputs :
1313 ref_name :
14+ description : " the ref (tag/branch) to use to extract tag/version"
1415 required : true
1516 type : string
17+ version :
18+ description : " override for version, will be used instead of ref if set, used for testing"
19+ required : false
20+ type : string
1621 schedule :
1722 - cron : ' 0 9 * * *'
1823env :
@@ -28,43 +33,11 @@ permissions:
2833jobs :
2934 get-tag-name :
3035 name : Get tag name
31- runs-on : ubuntu-latest
32- timeout-minutes : 2
33- outputs :
34- tag : ${{ steps.check-tag.outputs.tag }}
35- version : ${{ steps.check-tag.outputs.version }}
36- commit : ${{ steps.export-commit.outputs.commit }}
37- steps :
38- - name : Check tag from workflow input and github ref
39- id : check-tag
40- run : |
41- if [ -n "${{ inputs.ref_name }}" ]; then
42- tag=${{ inputs.ref_name }}
43- else
44- tag=${{ github.ref_name }}
45- fi
46- echo "tag=$tag" >> ${GITHUB_OUTPUT}
47-
48- version=${tag#v}
49- if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
50- echo "Version matches format: $version"
51- else
52- echo "Version $version doesn't match format. Using test version: 0.0.1"
53- version="0.0.1"
54- fi
55- echo "version=$version" >> ${GITHUB_OUTPUT}
56- - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
57- with :
58- ref : ${{ steps.check-tag.outputs.tag }}
59- fetch-depth : 0
60- persist-credentials : false
61- submodules : true
62- - name : Export commit hash
63- id : export-commit
64- run : |
65- commit=$(git rev-parse HEAD)
66- echo "commit=$commit" >> ${GITHUB_OUTPUT}
67-
36+ uses : ./.github/workflows/get-version-and-tag-for-ref.yaml
37+ with :
38+ ref_name : ${{ inputs.ref_name }}
39+ version : ${{ inputs.version }}
40+
6841 windows-msi-build :
6942 needs : get-tag-name
7043 runs-on : [self-hosted, windows, amd64, release]
9164 cache : false
9265 - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
9366 with :
94- ref : ${{ needs.get-tag-name.outputs.commit }}
67+ ref : ${{ needs.get-tag-name.outputs.tag }}
9568 fetch-depth : 0
9669 persist-credentials : false
9770 submodules : recursive
@@ -114,20 +87,22 @@ jobs:
11487 cd deps/finch-core && make clean
11588 - name : Build project
11689 run : |
90+ $dirty_tag = git describe --match 'v[0-9]*' --dirty='.modified' --always --tags
91+ Write-Host "dirty tag: $dirty_tag"
11792 make FINCH_OS_IMAGE_LOCATION_ROOT=__INSTALLFOLDER__
11893 - name : generate and download signed msi
11994 run : |
12095 $version="${{ needs.get-tag-name.outputs.version }}"
12196 $tag="${{ needs.get-tag-name.outputs.tag }}"
12297 powershell .\msi-builder\BuildFinchMSI.ps1 -Version $version
12398 $timestamp=[math]::truncate((Get-Date (Get-Date).ToUniversalTime() -UFormat "%s"))
124- $unsignedMSI="Finch-$tag -$timestamp.msi"
99+ $unsignedMSI="Finch-$version -$timestamp.msi"
125100 Write-Host "Upload unsigned MSI: $unsignedMSI"
126-
101+
127102 aws s3 cp "./msi-builder/build/Finch-$version.msi" "${{ secrets.WINDOWS_UNSIGNED_BUCKET }}$unsignedMSI" --acl bucket-owner-full-control --no-progress
128103 New-Item -Path "./msi-builder/build/signed/" -ItemType Directory -Force
129104
130- Write-Host "Attemp to download signed MSI"
105+ Write-Host "Attempt to download signed MSI"
131106 $retryCount = 0
132107 $maxRetries = 20
133108 $delay = 5
@@ -137,7 +112,7 @@ jobs:
137112 $signedMSI = aws s3 ls ${{ secrets.WINDOWS_SIGNED_BUCKET }} 2>&1 | Where-Object { $_ -match "$unsignedMSI" } | Sort-Object -Descending | Select-Object -First 1 | ForEach-Object { ($_ -split '\s+')[-1] }
138113 if ($signedMSI -and ($signedMSI -notlike "*An error occurred (404) when calling the HeadObject operation*")) {
139114 try {
140- aws s3 cp "${{ secrets.WINDOWS_SIGNED_BUCKET }}$signedMSI" "./msi-builder/build/signed/Finch-$tag .msi"
115+ aws s3 cp "${{ secrets.WINDOWS_SIGNED_BUCKET }}$signedMSI" "./msi-builder/build/signed/Finch-$version .msi"
141116 break
142117 } catch {
143118 Write-Host "Error during copy: $_"
@@ -159,8 +134,8 @@ jobs:
159134 aws-region : ${{ secrets.REGION }}
160135 - name : upload signed MSI to S3
161136 run : |
162- $tag ="${{ needs.get-tag-name.outputs.tag }}"
163- aws s3 cp "./msi-builder/build/signed/Finch-$tag .msi" "s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-$tag .msi" --no-progress
137+ $version ="${{ needs.get-tag-name.outputs.version }}"
138+ aws s3 cp "./msi-builder/build/signed/Finch-$version .msi" "s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-$version .msi" --no-progress
164139 - name : Remove Finch VM and Clean Up Previous Environment
165140 if : ${{ always() }}
166141 timeout-minutes : 5
@@ -235,8 +210,8 @@ jobs:
235210 }
236211 - name : Download MSI from S3
237212 run : |
238- $tag ="${{ needs.get-tag-name.outputs.tag }}"
239- aws s3 cp "s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-$tag .msi" ./Finch.msi
213+ $version ="${{ needs.get-tag-name.outputs.version }}"
214+ aws s3 cp "s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-$version .msi" ./Finch.msi
240215 - name : Install MSI silently
241216 run : |
242217 Start-Process 'Finch.msi' -ArgumentList '/quiet' -Wait
0 commit comments