name: Build & Release on: push: branches: [master] tags: ["v*.*.*"] pull_request: branches: [master] jobs: build: name: Build — ${{ matrix.name }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - name: Linux x86_64 (static) os: ubuntu-latest target: x86_64-unknown-linux-musl binary: ares asset: ares-linux-x86_64 - name: Windows x86_64 os: windows-latest target: x86_64-pc-windows-msvc binary: ares.exe asset: ares-windows-x86_64.exe steps: - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Install musl-tools (Linux only) if: matrix.target == 'x86_64-unknown-linux-musl' run: sudo apt-get install -y musl-tools - name: Cache cargo registry uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-cargo- - name: Build release binary run: cargo build --release --target ${{ matrix.target }} - name: Rename binary shell: bash run: | cp target/${{ matrix.target }}/release/${{ matrix.binary }} ${{ matrix.asset }} - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.asset }} path: ${{ matrix.asset }} retention-days: 7 release: name: Create GitHub Release needs: build runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') permissions: contents: write steps: - uses: actions/download-artifact@v4 with: path: artifacts merge-multiple: true - name: Create release uses: softprops/action-gh-release@v2 with: files: artifacts/* generate_release_notes: true