name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: rustup component add clippy --toolchain ${{ matrix.toolchain }}
- name: Test
run: RUST_BACKTRACE=1 cargo test --verbose
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
create-release:
name: create-release
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v5
- name: Get the release version from the tag
if: env.VERSION == ''
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Show the version
run: |
echo "version is: $VERSION"
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create $VERSION --draft --verify-tag --title $VERSION
outputs:
version: ${{ env.VERSION }}
release:
name: release
needs: create-release
strategy:
matrix:
platform:
- os-name: Linux-x86_64
runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os-name: macOS-x86_64
runs-on: macOS-latest
target: x86_64-apple-darwin
- os-name: macOS-aarch64
runs-on: macOS-latest
target: aarch64-apple-darwin
- os-name: Windows-x86_64
runs-on: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.platform.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Openssl (Linux only)
if: startsWith(matrix.platform.os-name, 'Linux')
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
- name: Build binary
uses: houseabsolute/actions-rust-cross@v1
with:
command: build
target: ${{ matrix.platform.target }}
args: "--locked --release"
strip: true
- name: Publish artifacts and release
uses: houseabsolute/actions-rust-release@v0
with:
executable-name: webinfo
target: ${{ matrix.platform.target }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}