46 lines
1.6 KiB
YAML
46 lines
1.6 KiB
YAML
name: Release
|
|
|
|
# v* tags build the Windows binary and attach it to a Gitea release.
|
|
# Manual runs (Actions tab -> Release -> Run workflow) build the same zip as a
|
|
# downloadable workflow artifact without creating a release.
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
TARGET: x86_64-pc-windows-gnu
|
|
# Statically link the C runtime so the .exe needs no mingw DLLs alongside it.
|
|
RUSTFLAGS: -C target-feature=+crt-static
|
|
|
|
jobs:
|
|
windows:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-pc-windows-gnu
|
|
- name: Install mingw-w64
|
|
run: sudo apt-get update && sudo apt-get install -y gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 zip
|
|
- run: cargo build --release --locked --target "$TARGET"
|
|
- name: Package
|
|
run: |
|
|
if [ "$GITHUB_REF_TYPE" = "tag" ]; then version="$GITHUB_REF_NAME"; else version="$(git rev-parse --short HEAD)"; fi
|
|
name="logreadlite-${version}-windows-x86_64"
|
|
mkdir "$name"
|
|
cp "target/$TARGET/release/logreadlite.exe" README.md "$name/"
|
|
x86_64-w64-mingw32-strip "$name/logreadlite.exe"
|
|
zip -r "$name.zip" "$name"
|
|
echo "ZIP=$name.zip" >> "$GITHUB_ENV"
|
|
# Gitea's artifact backend is compatible with upload-artifact v3.
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ env.ZIP }}
|
|
path: ${{ env.ZIP }}
|
|
- name: Create Gitea release
|
|
if: github.ref_type == 'tag'
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
files: ${{ env.ZIP }}
|