hopefully fix

This commit is contained in:
lily 2025-08-23 09:48:57 +10:00
parent 79177be9a5
commit 833a9f57e9

View file

@ -3,11 +3,11 @@ name: Create Release on Push (GitHub)
on: on:
push: push:
branches: branches:
- master # or your default branch, e.g., master - master # or your default branch
workflow_dispatch: # Allows manual triggering of the workflow workflow_dispatch: # Allows manual triggering of the workflow
jobs: jobs:
build_linux: build_linux_amd64:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
@ -18,16 +18,39 @@ jobs:
- name: Install build dependencies - name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential run: sudo apt-get update && sudo apt-get install -y build-essential
- name: Build project for Linux - name: Build project for Linux (AMD64)
run: make all run: make all
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
- name: Upload Linux artifact - name: Upload Linux AMD64 artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: agg-linux-amd64 name: agg-linux-amd64
path: bin/agg path: bin/agg
build_linux_aarch64:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install cross-compilation tools
run: |\
sudo apt-get update
sudo apt-get install -y build-essential gcc-aarch64-linux-gnu
- name: Build project for Linux (AArch64)
run: make CC=aarch64-linux-gnu-gcc all
working-directory: ${{ github.workspace }}
- name: Upload Linux AArch64 artifact
uses: actions/upload-artifact@v4
with:
name: agg-linux-aarch64
path: bin/agg
build_windows_amd64: build_windows_amd64:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
@ -37,120 +60,75 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Install MinGW/GCC and Make - name: Install MinGW/GCC and Make
run: | run: |\
choco install mingw --limit-features choco install mingw --limit-features
choco install make --limit-features choco install make --limit-features
# Add MinGW bin directory to PATH for the current session # Add MinGW bin directory to PATH for the current session
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding Utf8 -Append "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding Utf8 -Append
shell: powershell shell: powershell
- name: Build project for Windows - name: Build project for Windows (AMD64)
run: make all run: make all
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
shell: pwsh # Using PowerShell for more reliable path handling on Windows shell: pwsh
- name: Upload Windows artifact - name: Upload Windows AMD64 artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: agg-windows-amd64 name: agg-windows-amd64
path: bin/agg.exe path: bin/agg.exe
build_linux_aarch64:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install cross-compilation tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential gcc-aarch64-linux-gnu
- name: Build project for Linux (aarch64)
run: make CC=aarch64-linux-gnu-gcc all
working-directory: ${{ github.workspace }}
- name: Upload Linux aarch64 artifact
uses: actions/upload-artifact@v4
with:
name: agg-linux-aarch64
path: bin/agg
build_windows_aarch64: build_windows_aarch64:
runs-on: ubuntu-latest # Cross-compile from Linux runner runs-on: windows-latest # Cross-compile from an x64 Windows runner
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install cross-compilation tools for Windows (AArch64) - name: Install MinGW-w64 AArch64 toolchain
run: | run: |\
sudo apt-get update # Attempt to install via Choco. Package names for AArch64 MinGW can vary.
sudo apt-get install -y build-essential g++-aarch64-w64-mingw32 # We'll try common package names. If these fail, manual download/setup of a toolchain
# from MSYS2 or similar might be needed.
choco install mingw-w64-ucrt-aarch64 --limit-features || `
choco install mingw-w64-arm-none-eabi --limit-features || `
Write-Host "Could not install AArch64 MinGW via Choco. Manual intervention might be needed." -ForegroundColor Red
# Add the appropriate bin directory to PATH for the current session.
# This path depends on which choco package was actually installed.
# We'll try common paths.
if (Test-Path "C:\\ProgramData\\chocolatey\\lib\\mingw-w64-ucrt-aarch64\\tools\\install\\mingw64\\bin") {
"C:\\ProgramData\\chocolatey\\lib\\mingw-w64-ucrt-aarch64\\tools\\install\\mingw64\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding Utf8 -Append
} elseif (Test-Path "C:\\ProgramData\\chocolatey\\lib\\mingw-w64-arm-none-eabi\\tools\\install\\mingw64\\bin") {
"C:\\ProgramData\\chocolatey\\lib\\mingw-w64-arm-none-eabi\\tools\\install\\mingw64\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding Utf8 -Append
} else {
Write-Host "Could not find MinGW AArch64 bin path after install. Build might fail." -ForegroundColor Yellow
}
shell: powershell
- name: Build project for Windows (AArch64) - name: Build project for Windows (AArch64)
run: make CC=aarch64-w64-mingw32-gcc all run: make CC=aarch64-w64-mingw32-gcc all
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
shell: pwsh # Use PowerShell for consistent path handling
- name: Upload Windows aarch64 artifact - name: Upload Windows AArch64 artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: agg-windows-aarch64 name: agg-windows-aarch64
path: bin/agg.exe # Windows executables have .exe extension path: bin/agg.exe # Windows executables have .exe extension
build_windows_aarch64: create_release_and_upload_assets:
runs-on: windows-latest # Cross-compile from an x64 Windows runner runs-on: ubuntu-latest
steps: needs:
- name: Checkout code [
uses: actions/checkout@v3 build_linux_amd64,
with: build_linux_aarch64,
fetch-depth: 0 build_windows_amd64,
build_windows_aarch64,
- name: Install MinGW-w64 AArch64 toolchain ]
run: | permissions:
# Attempt to install via Choco. Package names for AArch64 MinGW can vary. contents: write # Grant write permissions to the GITHUB_TOKEN for creating releases
# We'll try common package names. If these fail, manual download/setup of a toolchain
# from MSYS2 or similar might be needed.
choco install mingw-w64-ucrt-aarch64 --limit-features || \
choco install mingw-w64-arm-none-eabi --limit-features || \
Write-Host "Could not install AArch64 MinGW via Choco. Manual intervention might be needed." -ForegroundColor Red
# Add the appropriate bin directory to PATH for the current session.
# This path depends on which choco package was actually installed.
# We'll try common paths.
if (Test-Path "C:\ProgramData\chocolatey\lib\mingw-w64-ucrt-aarch64\tools\install\mingw64\bin") {
"C:\ProgramData\chocolatey\lib\mingw-w64-ucrt-aarch64\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding Utf8 -Append
} elseif (Test-Path "C:\ProgramData\chocolatey\lib\mingw-w64-arm-none-eabi\tools\install\mingw64\bin") {
"C:\ProgramData\chocolatey\lib\mingw-w64-arm-none-eabi\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding Utf8 -Append
} else {
Write-Host "Could not find MinGW AArch64 bin path after install. Build might fail." -ForegroundColor Yellow
}
shell: powershell
- name: Build project for Windows (AArch64)
run: make CC=aarch64-w64-mingw32-gcc all
working-directory: ${{ github.workspace }}
shell: pwsh # Use PowerShell for consistent path handling
- name: Upload Windows aarch64 artifact
uses: actions/upload-artifact@v4
with:
name: agg-windows-aarch64
path: bin/agg.exe # Windows executables have .exe extension
create_release_and_upload_assets:
runs-on: ubuntu-latest
needs: [
build_linux,
build_windows_amd64,
build_linux_aarch64,
build_windows_aarch64,
] # Depends on all build jobs to complete
permissions:
contents: write # Grant write permissions to the GITHUB_TOKEN for creating releases
steps: steps:
- name: Checkout code - name: Checkout code
@ -160,7 +138,7 @@ jobs:
- name: Get latest unique tag - name: Get latest unique tag
id: get_tag id: get_tag
run: | run: |\
LATEST_TAG=$(git tag --sort=-v:refname | head -n1 || echo "v0.0.0") LATEST_TAG=$(git tag --sort=-v:refname | head -n1 || echo "v0.0.0")
echo "Debug: Initial LATEST_TAG: $LATEST_TAG" echo "Debug: Initial LATEST_TAG: $LATEST_TAG"
@ -194,63 +172,51 @@ jobs:
id: create_release id: create_release
uses: actions/create-release@v1 uses: actions/create-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use the default GITHUB_TOKEN GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ env.NEW_TAG }} tag_name: ${{ env.NEW_TAG }}
release_name: Release ${{ env.NEW_TAG }} release_name: Release ${{ env.NEW_TAG }}
body: | body: |\
Automated release created on push. Automated release created on push.
Commit: ${{ github.sha }} Commit: ${{ github.sha }}
draft: false draft: false
prerelease: false prerelease: false
- name: Download Linux artifact - name: Download Linux AMD64 artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: agg-linux-amd64 name: agg-linux-amd64
path: ./artifacts/linux/ path: ./artifacts/linux-amd64/
- name: Download Windows artifact - name: Download Linux AArch64 artifact
uses: actions/download-artifact@v4
with:
name: agg-windows-amd64
path: ./artifacts/windows/
- name: Download Linux aarch64 artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: agg-linux-aarch64 name: agg-linux-aarch64
path: ./artifacts/linux-aarch64/ path: ./artifacts/linux-aarch64/
- name: Upload Linux Release Asset - name: Download Windows AMD64 artifact
uses: actions/upload-release-asset@v1 uses: actions/download-artifact@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ steps.create_release.outputs.upload_url }} name: agg-windows-amd64
asset_path: ./artifacts/linux/agg path: ./artifacts/windows-amd64/
asset_name: agg-${{ env.NEW_TAG }}-linux-amd64
asset_content_type: application/octet-stream
- name: Download Windows aarch64 artifact - name: Download Windows AArch64 artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: agg-windows-aarch64 name: agg-windows-aarch64
path: ./artifacts/windows-aarch64/ path: ./artifacts/windows-aarch64/
- name: Upload Windows aarch64 Release Asset - name: Upload Linux AMD64 Release Asset
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/windows-aarch64/agg.exe asset_path: ./artifacts/linux-amd64/agg
asset_name: agg-${{ env.NEW_TAG }}-windows-aarch64.exe asset_name: agg-${{ env.NEW_TAG }}-linux-amd64
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
- name: Upload Linux AArch64 Release Asset
- name: Upload Linux aarch64 Release Asset
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -260,13 +226,17 @@ jobs:
asset_name: agg-${{ env.NEW_TAG }}-linux-aarch64 asset_name: agg-${{ env.NEW_TAG }}-linux-aarch64
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
- name: Download Windows aarch64 artifact - name: Upload Windows AMD64 Release Asset
uses: actions/download-artifact@v4 uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
name: agg-windows-aarch64 upload_url: ${{ steps.create_release.outputs.upload_url }}
path: ./artifacts/windows-aarch64/ asset_path: ./artifacts/windows-amd64/agg.exe
asset_name: agg-${{ env.NEW_TAG }}-windows-amd64.exe
asset_content_type: application/octet-stream
- name: Upload Windows aarch64 Release Asset - name: Upload Windows AArch64 Release Asset
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -275,13 +245,3 @@ jobs:
asset_path: ./artifacts/windows-aarch64/agg.exe asset_path: ./artifacts/windows-aarch64/agg.exe
asset_name: agg-${{ env.NEW_TAG }}-windows-aarch64.exe asset_name: agg-${{ env.NEW_TAG }}-windows-aarch64.exe
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
- name: Upload Windows Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/windows/agg.exe
asset_name: agg-${{ env.NEW_TAG }}-windows-amd64.exe
asset_content_type: application/octet-stream