name: Build on: push: branches: [ main ] tags: [ 'v*' ] pull_request: workflow_dispatch: jobs: build: name: ${{ matrix.name }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - name: macos-arm64 os: macos-latest exe: HAMLET archive: tar.gz - name: linux-x64 os: ubuntu-latest exe: HAMLET archive: tar.gz - name: windows-x64 os: windows-latest exe: HAMLET.exe archive: zip steps: - uses: actions/checkout@v4 - name: Configure run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release - name: Build run: cmake --build build --config Release --parallel - name: Package shell: bash run: | mkdir stage dist if [ -f "build/Release/${{ matrix.exe }}" ]; then cp "build/Release/${{ matrix.exe }}" stage/ else cp "build/${{ matrix.exe }}" stage/ fi cp README.md LICENSE stage/ ARCHIVE="dist/HAMLET-${{ matrix.name }}.${{ matrix.archive }}" if [ "${{ matrix.archive }}" = "zip" ]; then 7z a "$ARCHIVE" ./stage/* else tar czf "$ARCHIVE" -C stage . fi - uses: actions/upload-artifact@v4 with: name: HAMLET-${{ matrix.name }} path: dist/* release: name: Release if: startsWith(github.ref, 'refs/tags/v') needs: build runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/download-artifact@v4 with: path: dist merge-multiple: true - name: Publish release env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} TAG: ${{ github.ref_name }} run: | if gh release view "$TAG" >/dev/null 2>&1; then gh release upload "$TAG" dist/* --clobber else gh release create "$TAG" dist/* --title "$TAG" --generate-notes fi