only reference target name once #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2026 SombrAbsol | |
| # | |
| # SPDX-License-Identifier: MIT | |
| name: CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| paths: | |
| - ".github/workflows/ci.yml" | |
| - "src/**" | |
| - "include/**" | |
| - "Makefile" | |
| pull_request: | |
| branches: [ "main" ] | |
| paths: | |
| - ".github/workflows/ci.yml" | |
| - "src/**" | |
| - "include/**" | |
| - "Makefile" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| TARGET: acftool | |
| jobs: | |
| build: | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, macos-26, windows-2025] | |
| include: | |
| - os: ubuntu-24.04 | |
| artifact-suffix: linux | |
| extension: "" | |
| - os: macos-26 | |
| artifact-suffix: macos | |
| extension: "" | |
| - os: windows-2025 | |
| artifact-suffix: windows | |
| extension: .exe | |
| name: Build ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install LLVM (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get install -y llvm | |
| - name: Install LLVM (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install llvm | |
| echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH | |
| - name: Build ${{ env.TARGET }} | |
| run: make CC=clang release | |
| - name: Upload ${{ env.TARGET }} artefact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ env.TARGET }}-${{ matrix.artifact-suffix }} | |
| path: | | |
| build/${{ env.TARGET }}${{ matrix.extension }} | |
| LICENSE | |
| if-no-files-found: error | |
| retention-days: 7 | |
| release-latest: | |
| name: Update latest release | |
| needs: build | |
| if: github.event_name != 'pull_request' | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artefacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: artifacts/ | |
| - name: Package ZIPs | |
| run: | | |
| for suffix in linux macos windows; do | |
| dir="artifacts/${{ env.TARGET }}-${suffix}" | |
| ext="" | |
| [ "$suffix" = "windows" ] && ext=".exe" | |
| mkdir -p "pkg/${suffix}" | |
| mv "${dir}/build/${{ env.TARGET }}${ext}" "pkg/${suffix}/" | |
| mv "${dir}/LICENSE" "pkg/${suffix}/" | |
| (cd "pkg/${suffix}" && zip "../../${{ env.TARGET }}-${suffix}.zip" "${{ env.TARGET }}${ext}" LICENSE) | |
| done | |
| - name: Update latest release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: latest | |
| name: Latest build | |
| prerelease: true | |
| body: | | |
| Automated build from commit ${{ github.sha }}. | |
| files: | | |
| ${{ env.TARGET }}-linux.zip | |
| ${{ env.TARGET }}-macos.zip | |
| ${{ env.TARGET }}-windows.zip |