Skip to content

release: prepare 0.4.3 #2

release: prepare 0.4.3

release: prepare 0.4.3 #2

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
check-version:
name: Verify tag matches Cargo.toml
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check tag/version consistency
run: |
CARGO_VERSION=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')
TAG_VERSION="${GITHUB_REF_NAME#v}"
if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
echo "::error::Tag $GITHUB_REF_NAME does not match Cargo.toml version $CARGO_VERSION"
exit 1
fi
echo "Tag $GITHUB_REF_NAME matches Cargo.toml version $CARGO_VERSION"
build:
name: Build (${{ matrix.target }})
needs: [check-version]
if: ${{ !failure() && !cancelled() }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
asset_name: xmllint_linux-x86-64
- target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04
asset_name: xmllint_linux-aarch64
cross: true
- target: x86_64-apple-darwin
runner: macos-14
asset_name: xmllint_darwin-x86-64
- target: aarch64-apple-darwin
runner: macos-14
asset_name: xmllint_darwin-aarch64
- target: x86_64-pc-windows-msvc
runner: windows-2022
asset_name: xmllint_windows-x86-64.exe
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
key: ${{ matrix.target }}
- name: Install cross
if: matrix.cross
uses: taiki-e/install-action@b651345a718c8f44efa2460560b3dbf29cbd7ee1 # v2
with:
tool: cross
- name: Build (cross)
if: matrix.cross
run: cross build --release --features cli --target ${{ matrix.target }}
- name: Build (native)
if: "!matrix.cross"
run: cargo build --release --features cli --target ${{ matrix.target }}
- name: Rename binary (Unix)
if: runner.os != 'Windows'
run: |
cp target/${{ matrix.target }}/release/xmllint ${{ matrix.asset_name }}
- name: Rename binary (Windows)
if: runner.os == 'Windows'
run: |
Copy-Item "target/${{ matrix.target }}/release/xmllint.exe" "${{ matrix.asset_name }}"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}
release:
name: Create Release
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
merge-multiple: true
- name: Generate SHA256SUMS
run: sha256sum xmllint_* > SHA256SUMS
- name: Create GitHub Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
with:
files: |
xmllint_*
SHA256SUMS
generate_release_notes: true