Skip to content

Commit fe0f564

Browse files
ci(build): add linux release automation and release automation validation
Signed-off-by: Swapnanil Gupta <swpnlg@amazon.com>
1 parent 29f81de commit fe0f564

File tree

10 files changed

+566
-133
lines changed

10 files changed

+566
-133
lines changed

.github/workflows/build-and-test-msi.yaml

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ on:
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 * * *'
1823
env:
@@ -28,43 +33,11 @@ permissions:
2833
jobs:
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]
@@ -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"
12699
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

.github/workflows/build-and-test-pkg.yaml

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ on:
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 * * *'
1823
env:
@@ -28,36 +33,10 @@ permissions:
2833
jobs:
2934
get-tag-name:
3035
name: Get tag name
31-
runs-on: ubuntu-latest
32-
permissions:
33-
contents: read
34-
timeout-minutes: 2
35-
outputs:
36-
tag: ${{ steps.check-tag.outputs.tag }}
37-
commit: ${{ steps.export-commit.outputs.commit }}
38-
steps:
39-
- name: Check tag from workflow input and github ref
40-
id: check-tag
41-
run: |
42-
if [ -n "${{ inputs.ref_name }}" ]; then
43-
tag=${{ inputs.ref_name }}
44-
else
45-
tag=${{ github.ref_name }}
46-
fi
47-
echo "using tag=${tag}"
48-
echo "tag=$tag" >> ${GITHUB_OUTPUT}
49-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
50-
with:
51-
ref: ${{ steps.check-tag.outputs.tag }}
52-
fetch-depth: 0
53-
persist-credentials: false
54-
submodules: true
55-
- name: Export commit hash
56-
id: export-commit
57-
run: |
58-
commit=$(git rev-parse HEAD)
59-
echo "using commit=${commit}"
60-
echo "commit=$commit" >> ${GITHUB_OUTPUT}
36+
uses: ./.github/workflows/get-version-and-tag-for-ref.yaml
37+
with:
38+
ref_name: ${{ inputs.ref_name }}
39+
version: ${{ inputs.version }}
6140

6241
macos-aarch64-pkg-build:
6342
needs: get-tag-name
@@ -75,7 +54,7 @@ jobs:
7554
output_arch: aarch64
7655
version: 14
7756
tag: ${{ needs.get-tag-name.outputs.tag }}
78-
commit: ${{ needs.get-tag-name.outputs.commit }}
57+
finch_version: ${{ needs.get-tag-name.outputs.version }}
7958

8059
macos-x86-64-pkg-build:
8160
needs: get-tag-name
@@ -93,7 +72,7 @@ jobs:
9372
output_arch: x86_64
9473
version: 14
9574
tag: ${{ needs.get-tag-name.outputs.tag }}
96-
commit: ${{ needs.get-tag-name.outputs.commit }}
75+
finch_version: ${{ needs.get-tag-name.outputs.version }}
9776

9877
macos-aarch64-pkg-test:
9978
strategy:
@@ -116,8 +95,7 @@ jobs:
11695
arch: arm64
11796
output_arch: aarch64
11897
version: ${{ matrix.version }}
119-
tag: ${{ needs.get-tag-name.outputs.tag }}
120-
commit: ${{ needs.get-tag-name.outputs.commit }}
98+
finch_version: ${{ needs.get-tag-name.outputs.version }}
12199

122100
macos-x86-64-pkg-test:
123101
strategy:
@@ -140,5 +118,4 @@ jobs:
140118
arch: amd64
141119
output_arch: x86_64
142120
version: ${{ matrix.version }}
143-
tag: ${{ needs.get-tag-name.outputs.tag }}
144-
commit: ${{ needs.get-tag-name.outputs.commit }}
121+
finch_version: ${{ needs.get-tag-name.outputs.version }}

.github/workflows/build-pkg.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
tag:
1818
type: string
1919
required: true
20-
commit:
20+
finch_version:
2121
type: string
2222
required: true
2323

@@ -49,7 +49,7 @@ jobs:
4949
shell: zsh {0}
5050
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
5151
with:
52-
ref: ${{ inputs.commit }}
52+
ref: ${{ inputs.tag }}
5353
fetch-depth: 0
5454
persist-credentials: false
5555
submodules: true
@@ -79,7 +79,7 @@ jobs:
7979
run: |
8080
./installer-builder/tools/release-installer.sh \
8181
${{ inputs.output_arch }} \
82-
${{ inputs.tag }} \
82+
${{ inputs.finch_version }} \
8383
${{ secrets.INSTALLER_PRIVATE_BUCKET_NAME }} \
8484
${{ secrets.EXECUTABLE_BUCKET }} \
8585
${{ secrets.PKG_BUCKET }} \

.github/workflows/ci-docs.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ on:
2626
- '!.github/workflows/e2e-macos.yaml'
2727
- '!.github/workflows/e2e-windows.yaml'
2828
- '!.github/workflows/e2e-linux.yaml'
29+
- '!.github/workflows/release-automation.yaml'
30+
- '!.github/workflows/release-linux.yaml'
31+
- '!.github/workflows/upload-build-to-S3.yaml'
32+
- '!.github/workflows/build-and-test-msi.yaml'
33+
- '!.github/workflows/build-and-test-pkg.yaml'
34+
- '!.github/workflows/ci-release.yaml'
35+
- '!.github/workflows/get-version-and-tag-for-ref.yaml'
36+
- '!.github/workflows/ci-docs.yaml'
37+
- '!CHANGELOG.md'
2938
pull_request:
3039
branches:
3140
- main
@@ -43,6 +52,15 @@ on:
4352
- '!.github/workflows/e2e-macos.yaml'
4453
- '!.github/workflows/e2e-windows.yaml'
4554
- '!.github/workflows/e2e-linux.yaml'
55+
- '!.github/workflows/release-automation.yaml'
56+
- '!.github/workflows/release-linux.yaml'
57+
- '!.github/workflows/upload-build-to-S3.yaml'
58+
- '!.github/workflows/build-and-test-msi.yaml'
59+
- '!.github/workflows/build-and-test-pkg.yaml'
60+
- '!.github/workflows/ci-release.yaml'
61+
- '!.github/workflows/get-version-and-tag-for-ref.yaml'
62+
- '!.github/workflows/ci-docs.yaml'
63+
- '!CHANGELOG.md'
4664

4765
permissions:
4866
contents: read

0 commit comments

Comments
 (0)