@@ -34,16 +34,19 @@ jobs:
3434 fi
3535
3636 - name : Verify version consistency
37+ env :
38+ TAG_VERSION : ${{ github.ref_name }}
3739 run : |
38- TAG_VERSION="${{ github.ref_name }}"
3940 TAG_VERSION="${TAG_VERSION#v}"
40- PYPROJECT_VERSION=$(grep -oP '(?<=version = ")[^"]+' pyproject.toml )
41+ PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | grep -oP '(?<=version = ")[^"]+')
4142
4243 if [ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]; then
4344 echo "Error: Tag version ($TAG_VERSION) does not match pyproject.toml version ($PYPROJECT_VERSION)"
4445 exit 1
4546 fi
4647
48+ echo "Version check passed: $TAG_VERSION"
49+
4750 build :
4851 name : Build Binary - ${{ matrix.os-name }}
4952 needs : security-gate
@@ -52,26 +55,24 @@ jobs:
5255 fail-fast : false
5356 matrix :
5457 include :
55- - os : ubuntu-20 .04
58+ - os : ubuntu-22 .04
5659 os-name : Linux x86_64
5760 artifact_name : ar-infra
5861 asset_name : ar-infra-linux-amd64
59- build_args : " --strip"
60- - os : macos-13
61- os-name : macOS Intel
62- artifact_name : ar-infra
63- asset_name : ar-infra-macos-amd64
64- build_args : " "
6562 - os : macos-14
6663 os-name : macOS ARM64
6764 artifact_name : ar-infra
6865 asset_name : ar-infra-macos-arm64
69- build_args : " "
70- - os : windows-2019
66+ arch : arm64
67+ - os : macos-14
68+ os-name : macOS Intel (cross-compiled)
69+ artifact_name : ar-infra
70+ asset_name : ar-infra-macos-amd64
71+ arch : x86_64
72+ - os : windows-2022
7173 os-name : Windows x86_64
7274 artifact_name : ar-infra.exe
7375 asset_name : ar-infra-windows-amd64.exe
74- build_args : " "
7576
7677 steps :
7778 - name : Checkout code
@@ -97,20 +98,26 @@ jobs:
9798 run : |
9899 python -m pip install --upgrade pip
99100 pip install -r requirements.txt
100- pip install pyinstaller staticx patchelf
101+ pip install pyinstaller
102+ shell : bash
103+
104+ - name : Install Linux-specific tools
105+ if : runner.os == 'Linux'
106+ run : |
107+ pip install staticx patchelf
101108 shell : bash
102109
103110 - name : Build binary with PyInstaller
104111 run : |
105- pyinstaller ar-infra.spec ${{ matrix.build_args }}
112+ pyinstaller ar-infra.spec
106113 shell : bash
107114
108- - name : Create portable Linux binary
115+ - name : Verify Linux binary
109116 if : runner.os == 'Linux'
110117 run : |
111118 cd dist
112- staticx ${{ matrix.artifact_name }} ${{ matrix.artifact_name }}-static
113- mv ${{ matrix.artifact_name }}-static ${{ matrix.artifact_name }}
119+ file ${{ matrix.artifact_name }}
120+ ldd ${{ matrix.artifact_name }} || echo "Static binary or non-ELF"
114121 shell : bash
115122
116123 - name : Remove .env file
@@ -137,16 +144,22 @@ jobs:
137144 fi
138145 shell : bash
139146
140- - name : Calculate SHA256 checksum
147+ - name : Calculate SHA256 checksum (Unix)
148+ if : runner.os != 'Windows'
141149 run : |
142150 cd dist
143- if [[ "${{ runner.os }}" == "Windows" ]]; then
144- certutil -hashfile ${{ matrix.asset_name }} SHA256 > ${{ matrix.asset_name }}.sha256
145- else
146- shasum -a 256 ${{ matrix.asset_name }} > ${{ matrix.asset_name }}.sha256
147- fi
151+ shasum -a 256 ${{ matrix.asset_name }} > ${{ matrix.asset_name }}.sha256
148152 shell : bash
149153
154+ - name : Calculate SHA256 checksum (Windows)
155+ if : runner.os == 'Windows'
156+ run : |
157+ cd dist
158+ $hash = (Get-FileHash -Path "${{ matrix.asset_name }}" -Algorithm SHA256).Hash.ToLower()
159+ $filename = "${{ matrix.asset_name }}"
160+ "$hash $filename" | Out-File -Encoding ascii -NoNewline "${{ matrix.asset_name }}.sha256"
161+ shell : pwsh
162+
150163 - name : Upload build artifact
151164 uses : actions/upload-artifact@v4
152165 with :
@@ -183,8 +196,10 @@ jobs:
183196
184197 - name : Extract version number
185198 id : version
199+ env :
200+ REF_NAME : ${{ github.ref_name }}
186201 run : |
187- VERSION="${{ github.ref_name }} "
202+ VERSION="$REF_NAME "
188203 VERSION_NUMBER="${VERSION#v}"
189204 echo "version=${VERSION}" >> $GITHUB_OUTPUT
190205 echo "version_number=${VERSION_NUMBER}" >> $GITHUB_OUTPUT
@@ -330,12 +345,13 @@ jobs:
330345 - name : Get package version
331346 id : get_version
332347 run : |
333- VERSION=$(grep -oP '(?<=version = ")[^"]+' pyproject.toml )
348+ VERSION=$(grep '^version = ' pyproject.toml | grep -oP '(?<=version = ")[^"]+')
334349 echo "version=${VERSION}" >> $GITHUB_OUTPUT
335350 echo "Package version: ${VERSION}"
336351
337352 - name : Publish to PyPI
338353 uses : pypa/gh-action-pypi-publish@release/v1
339354 with :
355+ skip-existing : true
340356 verbose : true
341357 print-hash : true
0 commit comments