Skip to content

Commit 3fdb66f

Browse files
committed
cannot build macos cli with Cross tool, can we use the apple runners?
1 parent 743c740 commit 3fdb66f

File tree

1 file changed

+36
-24
lines changed

1 file changed

+36
-24
lines changed

.github/workflows/main.yaml

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,31 @@ jobs:
159159
echo "patch=$PATCH" >> $GITHUB_OUTPUT
160160
echo "Generated version: $NEW_VERSION"
161161
162+
build-macos-arm64:
163+
runs-on: macos-15
164+
needs: [generate-version]
165+
steps:
166+
- uses: actions/checkout@v4
167+
with:
168+
fetch-depth: 0
169+
170+
- name: Add Mac ARM64 target
171+
run: rustup target add aarch64-apple-darwin
172+
173+
- name: Build Mac ARM64
174+
run: cargo build --release --target aarch64-apple-darwin
175+
176+
- name: Prepare Mac ARM64 artifact
177+
run: |
178+
mkdir -p dist
179+
cp target/aarch64-apple-darwin/release/git-next-tag-rust dist/git-next-tag-rust-macos-arm64
180+
181+
- name: Upload Mac ARM64 artifact
182+
uses: actions/upload-artifact@v4
183+
with:
184+
name: cli-binary-macos-arm64
185+
path: dist/
186+
162187
build-artifacts:
163188
runs-on: ubuntu-latest
164189
needs: [generate-version]
@@ -178,19 +203,13 @@ jobs:
178203
- name: Build Windows AMD64
179204
run: cross build --release --target x86_64-pc-windows-gnu
180205

181-
- name: Add Mac Rust to PATH
182-
run: rustup target add aarch64-apple-darwin
183-
- name: Build Mac ARM64
184-
run: cross build --release --target aarch64-apple-darwin
206+
185207

186208
- name: Prepare artifacts
187209
run: |
188210
mkdir -p dist
189211
cp target/x86_64-unknown-linux-gnu/release/git-next-tag-rust dist/git-next-tag-rust-linux-amd64
190212
cp target/x86_64-pc-windows-gnu/release/git-next-tag-rust.exe dist/git-next-tag-rust-windows-amd64.exe
191-
cp target/aarch64-apple-darwin/release/git-next-tag-rust dist/git-next-tag-rust-macos-arm64
192-
cd dist
193-
sha256sum * > checksums.txt
194213
195214
- name: Upload build artifacts
196215
uses: actions/upload-artifact@v4
@@ -288,7 +307,7 @@ jobs:
288307
args: --severity-threshold=high
289308

290309
create-release:
291-
needs: [generate-version, build-and-push, image-security-scan]
310+
needs: [generate-version, build-and-push, image-security-scan, build-artifacts, build-macos-arm64]
292311
runs-on: ubuntu-latest
293312
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
294313
permissions:
@@ -320,29 +339,22 @@ jobs:
320339
draft: false
321340
prerelease: false
322341

323-
- name: Download build artifacts
342+
- name: Download Linux/Windows build artifacts
324343
uses: actions/download-artifact@v4
325344
with:
326345
name: cli-binaries
327346
path: dist/
328347

329-
- name: Create GitHub release
330-
uses: actions/create-release@v1
331-
env:
332-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
348+
- name: Download Mac ARM64 build artifact
349+
uses: actions/download-artifact@v4
333350
with:
334-
tag_name: v${{ needs.generate-version.outputs.version }}
335-
release_name: Release v${{ needs.generate-version.outputs.version }}
336-
body: |
337-
## Changes
338-
- Automated release v${{ needs.generate-version.outputs.version }}
339-
340-
## Container Image
341-
- `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.generate-version.outputs.version }}`
342-
- `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-and-push.outputs.image-digest }}`
351+
name: cli-binary-macos-arm64
352+
path: dist/
343353

344-
draft: false
345-
prerelease: false
354+
- name: Generate checksums
355+
run: |
356+
cd dist
357+
sha256sum git-next-tag-rust-linux-amd64 git-next-tag-rust-windows-amd64.exe git-next-tag-rust-macos-arm64 > checksums.txt
346358
347359
- name: Upload release assets
348360
uses: softprops/action-gh-release@v1

0 commit comments

Comments
 (0)