Skip to content

Commit a82e0b3

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

15 files changed

+696
-255
lines changed

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

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@ on:
1010
workflow_call:
1111
inputs:
1212
ref_name:
13+
description: "the ref (tag/branch) to use to extract tag/version"
1314
required: true
1415
type: string
16+
version:
17+
description: "override for version, will be used instead of ref if set, used for testing"
18+
required: false
19+
type: string
1520
schedule:
1621
- cron: '0 9 * * *'
1722
env:
@@ -25,47 +30,15 @@ permissions:
2530
contents: read # This is required for actions/checkout
2631

2732
jobs:
28-
get-tag-and-version:
33+
get-tag-name:
2934
name: Get tag name
30-
runs-on: ubuntu-latest
31-
timeout-minutes: 2
32-
outputs:
33-
tag: ${{ steps.check-tag.outputs.tag }}
34-
version: ${{ steps.check-tag.outputs.version }}
35-
commit: ${{ steps.export-commit.outputs.commit }}
36-
steps:
37-
- name: Check tag from workflow input and github ref
38-
id: check-tag
39-
run: |
40-
if [ -n "${{ inputs.ref_name }}" ]; then
41-
tag=${{ inputs.ref_name }}
42-
else
43-
tag=${{ github.ref_name }}
44-
fi
45-
echo "tag=$tag" >> ${GITHUB_OUTPUT}
46-
47-
version=${tag#v}
48-
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
49-
echo "Version matches format: $version"
50-
else
51-
echo "Version $version doesn't match format. Using test version: 0.0.1+{commit}"
52-
version="0.0.1+${{ github.sha }}"
53-
fi
54-
echo "version=$version" >> ${GITHUB_OUTPUT}
55-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
56-
with:
57-
ref: ${{ steps.check-tag.outputs.tag }}
58-
fetch-depth: 0
59-
persist-credentials: false
60-
submodules: true
61-
- name: Export commit hash
62-
id: export-commit
63-
run: |
64-
commit=$(git rev-parse HEAD)
65-
echo "commit=$commit" >> ${GITHUB_OUTPUT}
35+
uses: ./.github/workflows/get-version-and-tag-for-ref.yaml
36+
with:
37+
ref_name: ${{ inputs.ref_name }}
38+
version: ${{ inputs.version }}
6639

6740
ubuntu-deb-build-and-test:
68-
needs: get-tag-and-version
41+
needs: get-tag-name
6942
strategy:
7043
fail-fast: false
7144
matrix:
@@ -89,7 +62,7 @@ jobs:
8962
rm -rf ${{ github.workspace }}/*
9063
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
9164
with:
92-
ref: ${{ needs.get-tag-and-version.outputs.commit }}
65+
ref: ${{ needs.get-tag-name.outputs.tag }}
9366
fetch-depth: 0
9467
persist-credentials: false
9568
submodules: true
@@ -108,10 +81,10 @@ jobs:
10881
make
10982
- name: Generate deb
11083
run: |
111-
./contrib/packaging/deb/package.sh --${{ matrix.output-arch }} --version ${{ needs.get-tag-and-version.outputs.version }}
84+
./contrib/packaging/deb/package.sh --${{ matrix.output-arch }} --version ${{ needs.get-tag-name.outputs.version }}
11285
- name: Install Finch
11386
run: |
114-
sudo apt install ./_output/deb/runfinch-finch_${{ needs.get-tag-and-version.outputs.version }}_${{ matrix.output-arch }}.deb -y
87+
sudo apt install ./_output/deb/runfinch-finch_${{ needs.get-tag-name.outputs.version }}_${{ matrix.output-arch }}.deb -y
11588
sudo systemctl daemon-reload
11689
sudo systemctl start containerd.service
11790
sudo systemctl restart finch.socket
@@ -136,5 +109,5 @@ jobs:
136109
sudo apt remove zlib1g-dev -y
137110
- name: Upload deb to S3
138111
run: |
139-
aws s3 cp ./_output/deb s3://${{ secrets.DEB_PRIVATE_BUCKET_NAME_UNSIGNED_PROD }}/ --recursive --exclude "*" --include "runfinch-finch_${{ needs.get-tag-and-version.outputs.version }}_${{ matrix.output-arch }}.deb"
112+
aws s3 cp ./_output/deb s3://${{ secrets.DEB_PRIVATE_BUCKET_NAME_UNSIGNED_PROD }}/ --recursive --exclude "*" --include "runfinch-finch_${{ needs.get-tag-name.outputs.version }}_${{ matrix.output-arch }}.deb"
140113
aws s3 cp ./contrib/packaging/deb/Release s3://${{ secrets.DEB_PRIVATE_BUCKET_NAME_UNSIGNED_PROD }}/

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

Lines changed: 20 additions & 47 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]
@@ -91,7 +64,7 @@ jobs:
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

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

Lines changed: 14 additions & 35 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:
@@ -117,7 +96,7 @@ jobs:
11796
output_arch: aarch64
11897
version: ${{ matrix.version }}
11998
tag: ${{ needs.get-tag-name.outputs.tag }}
120-
commit: ${{ needs.get-tag-name.outputs.commit }}
99+
finch_version: ${{ needs.get-tag-name.outputs.version }}
121100

122101
macos-x86-64-pkg-test:
123102
strategy:
@@ -141,4 +120,4 @@ jobs:
141120
output_arch: x86_64
142121
version: ${{ matrix.version }}
143122
tag: ${{ needs.get-tag-name.outputs.tag }}
144-
commit: ${{ needs.get-tag-name.outputs.commit }}
123+
finch_version: ${{ needs.get-tag-name.outputs.version }}

0 commit comments

Comments
 (0)