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
@@ -121,13 +94,13 @@ jobs:
12194 $tag="${{ needs.get-tag-name.outputs.tag }}"
12295 powershell .\msi-builder\BuildFinchMSI.ps1 -Version $version
12396 $timestamp=[math]::truncate((Get-Date (Get-Date).ToUniversalTime() -UFormat "%s"))
124- $unsignedMSI="Finch-$tag -$timestamp.msi"
97+ $unsignedMSI="Finch-$version -$timestamp.msi"
12598 Write-Host "Upload unsigned MSI: $unsignedMSI"
126-
99+
127100 aws s3 cp "./msi-builder/build/Finch-$version.msi" "${{ secrets.WINDOWS_UNSIGNED_BUCKET }}$unsignedMSI" --acl bucket-owner-full-control --no-progress
128101 New-Item -Path "./msi-builder/build/signed/" -ItemType Directory -Force
129102
130- Write-Host "Attemp to download signed MSI"
103+ Write-Host "Attempt to download signed MSI"
131104 $retryCount = 0
132105 $maxRetries = 20
133106 $delay = 5
@@ -137,7 +110,7 @@ jobs:
137110 $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] }
138111 if ($signedMSI -and ($signedMSI -notlike "*An error occurred (404) when calling the HeadObject operation*")) {
139112 try {
140- aws s3 cp "${{ secrets.WINDOWS_SIGNED_BUCKET }}$signedMSI" "./msi-builder/build/signed/Finch-$tag .msi"
113+ aws s3 cp "${{ secrets.WINDOWS_SIGNED_BUCKET }}$signedMSI" "./msi-builder/build/signed/Finch-$version .msi"
141114 break
142115 } catch {
143116 Write-Host "Error during copy: $_"
@@ -159,8 +132,8 @@ jobs:
159132 aws-region : ${{ secrets.REGION }}
160133 - name : upload signed MSI to S3
161134 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
135+ $version ="${{ needs.get-tag-name.outputs.version }}"
136+ aws s3 cp "./msi-builder/build/signed/Finch-$version .msi" "s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-$version .msi" --no-progress
164137 - name : Remove Finch VM and Clean Up Previous Environment
165138 if : ${{ always() }}
166139 timeout-minutes : 5
@@ -235,8 +208,8 @@ jobs:
235208 }
236209 - name : Download MSI from S3
237210 run : |
238- $tag ="${{ needs.get-tag-name.outputs.tag }}"
239- aws s3 cp "s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-$tag .msi" ./Finch.msi
211+ $version ="${{ needs.get-tag-name.outputs.version }}"
212+ aws s3 cp "s3://${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }}/Finch-$version .msi" ./Finch.msi
240213 - name : Install MSI silently
241214 run : |
242215 Start-Process 'Finch.msi' -ArgumentList '/quiet' -Wait
0 commit comments