Skip to content

v8.0.0

v8.0.0 #47

Workflow file for this run

name: GitHub Release
on:
release:
types: [ published ]
jobs:
release:
name: Release
strategy:
matrix:
kind: [ 'linux', 'macos', 'windows' ]
include:
- kind: linux
os: ubuntu-latest
target: linux
- 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}"
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 -p:StripSymbols=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
- name: Publish
uses: softprops/action-gh-release@v2
with:
files: |
HostsParser*.zip
HostsParser*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}