@@ -22,12 +22,16 @@ jobs:
22
22
uses : " WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce" # v1.4.0
23
23
generate-artifacts :
24
24
needs : get-latest-tag
25
- runs-on : ubuntu-20.04
25
+ runs-on : ${{ matrix.os }}
26
+ strategy :
27
+ matrix :
28
+ os : [ubuntu-20.04]
29
+ arch : [amd64, arm64]
26
30
env :
27
- # Set during setup.
28
31
RELEASE_TAG : ${{ needs.get-latest-tag.outputs.tag }}
29
32
DYNAMIC_BINARY_NAME : ' '
30
33
STATIC_BINARY_NAME : ' '
34
+ RELEASE_VERSION : ' '
31
35
steps :
32
36
- uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
33
37
with :
@@ -42,68 +46,104 @@ jobs:
42
46
run : |
43
47
export release_tag=${{ env.RELEASE_TAG }}
44
48
export release_version=${release_tag/v/} # Remove v from tag name
45
- echo "DYNAMIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64 .tar.gz" >> $GITHUB_ENV
46
- echo "STATIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64 -static.tar.gz" >> $GITHUB_ENV
47
-
49
+ echo "DYNAMIC_BINARY_NAME=finch-daemon-${release_version}-linux-${{ matrix.arch }} .tar.gz" >> $GITHUB_ENV
50
+ echo "STATIC_BINARY_NAME=finch-daemon-${release_version}-linux-${{ matrix.arch }} -static.tar.gz" >> $GITHUB_ENV
51
+ echo "RELEASE_VERSION=${release_version}" >> $GITHUB_ENV
48
52
mkdir release
49
53
- name : Install Go licenses
50
54
run : go install github.com/google/go-licenses@latest
55
+ - name : Install Cross Arch dependencies
56
+ run : |
57
+ if [ "${{ matrix.arch }}" = "arm64" ]; then
58
+ sudo apt update
59
+ sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
60
+ fi
51
61
- name : Create Third Party Licences File
52
62
run : make licenses
53
- - name : setup static dependecies
63
+ - name : setup static dependencies
54
64
run : |
55
65
sudo apt-get update
56
66
sudo apt-get install libc6-dev -f
57
67
- name : Create release binaries
58
- run : make RELEASE_TAG=${{ env.RELEASE_TAG }} release
59
- - name : Verify Release version
60
68
run : |
61
- mkdir -p output/static output/dynamic
62
- tar -xzf release/${{ env.DYNAMIC_BINARY_NAME }} -C ./output/dynamic
63
- tar -xzf release/${{ env.STATIC_BINARY_NAME }} -C ./output/static
64
- DYNAMIC_BINARY_VERSION=$(./output/dynamic/finch-daemon --version | grep -oP '\d+\.\d+\.\d+')
65
- STATIC_BINARY_VERSION=$(./output/static/finch-daemon --version | grep -oP '\d+\.\d+\.\d+')
66
- export release_tag=${{ env.RELEASE_TAG }}
67
- export release_version=${release_tag/v/}
68
- if ["$STATIC_BINARY_VERSION" != "$release_version"] || ["$DYNAMIC_BINARY_VERSION" != "$release_version"]; then
69
- echo "Version mismatch"
70
- exit 1
69
+ if [ "${{ matrix.arch }}" = "amd64" ]; then
70
+ make TARGET_ARCH=${{ matrix.arch }} RELEASE_TAG=${{ env.RELEASE_TAG }} release
71
+ elif [ "${{ matrix.arch }}" = "arm64" ]; then
72
+ make CC=aarch64-linux-gnu-gcc TARGET_ARCH=${{ matrix.arch }} RELEASE_TAG=${{ env.RELEASE_TAG }} release
71
73
fi
74
+ - name : Verify Release version
75
+ run : |
76
+ export HOST_ARCH=''
77
+ case $(uname -m) in
78
+ x86_64) HOST_ARCH="amd64" ;;
79
+ aarch64) HOST_ARCH="arm64" ;;
80
+ *) echo "Error: Unsupported arch $(uname -m)"; exit 1 ;;
81
+ esac
82
+ echo "Host Arch: $HOST_ARCH"
83
+ if [ "${{ matrix.arch }}" = "$HOST_ARCH" ]; then
84
+ mkdir -p output/static output/dynamic
85
+ tar -xzf release/${{ env.DYNAMIC_BINARY_NAME }} -C ./output/dynamic
86
+ tar -xzf release/${{ env.STATIC_BINARY_NAME }} -C ./output/static
87
+ DYNAMIC_BINARY_VERSION=$(./output/dynamic/finch-daemon --version | grep -oP '\d+\.\d+\.\d+')
88
+ STATIC_BINARY_VERSION=$(./output/static/finch-daemon --version | grep -oP '\d+\.\d+\.\d+')
89
+ export release_tag=${{ env.RELEASE_TAG }}
90
+ export release_version=${release_tag/v/}
91
+ echo "Dynamic version $DYNAMIC_BINARY_VERSION"
92
+ else
93
+ echo "Architecture mismatch: Cross Arch validation is not supported. Skipping version verification"
94
+ fi
72
95
shell : bash
73
96
- uses : actions/upload-artifact@v4
74
97
with :
75
- name : artifacts
98
+ name : artifacts-${{ matrix.arch }}
76
99
path : release/
77
100
if-no-files-found : error
78
101
outputs :
79
102
release_tag : ${{ env.RELEASE_TAG }}
103
+ release_version : ${{ env.RELEASE_VERSION }}
80
104
dynamic_binary_name : ${{ env.DYNAMIC_BINARY_NAME }}
81
105
static_binary_name : ${{ env.STATIC_BINARY_NAME }}
106
+
82
107
validate-artifacts :
83
108
needs : generate-artifacts
84
- runs-on : ubuntu-latest
109
+ runs-on : ${{ matrix.os }}
110
+ strategy :
111
+ matrix :
112
+ os : [ubuntu-latest]
113
+ arch : [amd64, arm64]
85
114
steps :
86
115
- uses : actions/checkout@v4
87
116
- uses : actions/download-artifact@v4
88
117
with :
89
- name : artifacts
118
+ name : artifacts-${{ matrix.arch }}
90
119
path : release/
91
120
- run : bash scripts/verify-release-artifacts.sh ${{ needs.generate-artifacts.outputs.release_tag }}
121
+ env :
122
+ TARGET_ARCH : ${{ matrix.arch }}
92
123
create-release :
93
124
needs : [generate-artifacts, validate-artifacts]
94
125
runs-on : ubuntu-latest
95
126
steps :
96
127
- uses : actions/checkout@v4
97
- - uses : actions/download-artifact@v4
128
+ - name : Download Artifact amd64
129
+ uses : actions/download-artifact@v4
130
+ with :
131
+ name : artifacts-amd64
132
+ - name : Download Artifact arm64
133
+ uses : actions/download-artifact@v4
98
134
with :
99
- name : artifacts
135
+ name : artifacts-arm64
100
136
- uses : softprops/action-gh-release@v2
101
137
with :
102
138
tag_name : ${{ needs.generate-artifacts.outputs.release_tag }}
103
139
prerelease : false
104
140
generate_release_notes : false
105
141
files : |
106
- ${{ needs.generate-artifacts.outputs.dynamic_binary_name }}
107
- ${{ needs.generate-artifacts.outputs.dynamic_binary_name }}.sha256sum
108
- ${{ needs.generate-artifacts.outputs.static_binary_name }}
109
- ${{ needs.generate-artifacts.outputs.static_binary_name }}.sha256sum
142
+ finch-daemon-${{ needs.generate-artifacts.outputs.release_version }}-linux-amd64.tar.gz
143
+ finch-daemon-${{ needs.generate-artifacts.outputs.release_version }}-linux-amd64.tar.gz.sha256sum
144
+ finch-daemon-${{ needs.generate-artifacts.outputs.release_version }}-linux-amd64-static.tar.gz
145
+ finch-daemon-${{ needs.generate-artifacts.outputs.release_version }}-linux-amd64-static.tar.gz.sha256sum
146
+ finch-daemon-${{ needs.generate-artifacts.outputs.release_version }}-linux-arm64.tar.gz
147
+ finch-daemon-${{ needs.generate-artifacts.outputs.release_version }}-linux-arm64.tar.gz.sha256sum
148
+ finch-daemon-${{ needs.generate-artifacts.outputs.release_version }}-linux-arm64-static.tar.gz
149
+ finch-daemon-${{ needs.generate-artifacts.outputs.release_version }}-linux-arm64-static.tar.gz.sha256sum
0 commit comments