Skip to content

v8.0.1-pre5

v8.0.1-pre5 #54

Workflow file for this run

name: GitHub Release
on:
release:
types: [ published ]
jobs:
release:
name: Release
strategy:
matrix:
kind: [ 'linux-x64', 'linux-arm64', 'macos', 'windows' ]
include:
- kind: linux-x64
os: ubuntu-latest
target: linux-x64
- kind: linux-arm64
os: ubuntu-24.04-arm
target: linux-arm64
- kind: macos
os: macos-latest
target: osx
- kind: windows
os: windows-latest
target: win
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
# Build everything
ASSEMBLY_VERSION="${tag//v}"
if [ "${{ matrix.kind }}" == "linux-x64" ] || [ "${{ matrix.kind }}" == "linux-arm64" ]; then
release_name="HostsParser-$tag-${{ matrix.target }}"
dotnet publish "./src/HostsParser/HostsParser.csproj" -r ${{ matrix.target }} -c Release -o release -p:Version="$ASSEMBLY_VERSION" -p:PublishAot=true
tar -czvf "${release_name}.tar.gz" -C ./release .
# Delete output directory
rm -r "./release"
else
for target_arch in "x64" "arm64"; do
target="${{ matrix.target }}-$target_arch"
release_name="HostsParser-$tag-$target"
if [ "$target_arch" == "arm64" ]; then
dotnet publish "./src/HostsParser/HostsParser.csproj" -r $target -c Release -o release -p:Version="$ASSEMBLY_VERSION"
else
dotnet publish "./src/HostsParser/HostsParser.csproj" -r $target -c Release -o release -p:Version="$ASSEMBLY_VERSION" -p:PublishAot=true
fi
if [ "${{ matrix.kind }}" == "windows" ]; then
# Pack to zip for Windows
7z a -tzip "${release_name}.zip" "./release/*"
else
# Pack tar.gz for non-Windows
tar -czvf "${release_name}.tar.gz" -C ./release .
fi
# Delete output directory
rm -r "./release"
done
fi
- name: Publish
uses: softprops/action-gh-release@v2
with:
files: |
HostsParser*.zip
HostsParser*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}