Skip to content

build: add github workflow #2

build: add github workflow

build: add github workflow #2

Workflow file for this run

name: Build
on:
push:
jobs:
build:
name: Build — ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl
binary: proxy-checker
artifact: proxy-checker-linux
- name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
binary: proxy-checker.exe
artifact: proxy-checker-windows
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get install -y musl-tools
- name: Cache
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
run: cargo build --release --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: target/${{ matrix.target }}/release/${{ matrix.binary }}
if-no-files-found: error
release:
name: Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download Linux binary
uses: actions/download-artifact@v4
with:
name: proxy-checker-linux
path: artifacts/linux
- name: Download Windows binary
uses: actions/download-artifact@v4
with:
name: proxy-checker-windows
path: artifacts/windows
- name: Mark Linux binary executable
run: chmod +x artifacts/linux/proxy-checker
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/linux/proxy-checker
artifacts/windows/proxy-checker.exe