Add author to README and switch to MIT license #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Zig 0.15.2 | |
| run: | | |
| curl -fL "https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz" -o zig.tar.xz | |
| tar -xf zig.tar.xz | |
| ZIG_DIR="$PWD/zig-x86_64-linux-0.15.2" | |
| echo "$ZIG_DIR" >> "$GITHUB_PATH" | |
| "$ZIG_DIR/zig" version | |
| - name: Install Cosmocc 4.0.2 | |
| run: | | |
| set -euo pipefail | |
| curl -fL "https://cosmo.zip/pub/cosmocc/cosmocc-4.0.2.zip" -o cosmocc.zip | |
| COSMO_ROOT="$RUNNER_TEMP/cosmocc" | |
| rm -rf "$COSMO_ROOT" | |
| mkdir -p "$COSMO_ROOT" | |
| unzip -q -o cosmocc.zip -d "$COSMO_ROOT" | |
| COSMO_DIR="$(find "$COSMO_ROOT" -maxdepth 1 -type d -name 'cosmocc-*' | head -n 1 || true)" | |
| if [ -z "${COSMO_DIR:-}" ]; then | |
| if [ -x "$COSMO_ROOT/bin/cosmocc" ]; then | |
| COSMO_DIR="$COSMO_ROOT" | |
| else | |
| echo "cosmocc installation layout not detected in $COSMO_ROOT" | |
| find "$COSMO_ROOT" -maxdepth 3 -type f | head -n 50 | |
| exit 1 | |
| fi | |
| fi | |
| test -x "$COSMO_DIR/bin/cosmocc" | |
| echo "$COSMO_DIR/bin" >> "$GITHUB_PATH" | |
| "$COSMO_DIR/bin/cosmocc" --version | |
| - name: Build matrix binaries (including cosmo) | |
| run: zig build matrix -Doptimize=ReleaseFast | |
| - name: Pack per-target archives | |
| run: | | |
| mkdir -p dist | |
| pack() { | |
| local src_file="$1" | |
| local archive_name="$2" | |
| tar -C "$(dirname "$src_file")" -czf "dist/${archive_name}.tar.gz" "$(basename "$src_file")" | |
| } | |
| pack "release/bin/webdav_linux_x86_64" "webdav_x86_64-linux-musl" | |
| pack "release/bin/webdav_linux_x86" "webdav_x86-linux-musl" | |
| pack "release/bin/webdav_linux_armv6" "webdav_arm-linux-musleabihf-arm1176jzf_s" | |
| pack "release/bin/webdav_linux_armv7" "webdav_arm-linux-musleabihf-cortex_a7" | |
| pack "release/bin/webdav_linux_arm64" "webdav_aarch64-linux-musl" | |
| pack "release/bin/webdav_linux_riscv64" "webdav_riscv64-linux-musl" | |
| pack "release/bin/webdav_linux_mips" "webdav_mips-linux-musleabi" | |
| pack "release/bin/webdav_linux_mipsel" "webdav_mipsel-linux-musleabi" | |
| pack "release/bin/webdav_linux_mips_hf" "webdav_mips-linux-musleabihf" | |
| pack "release/bin/webdav_linux_mipsel_hf" "webdav_mipsel-linux-musleabihf" | |
| pack "release/bin/webdav_linux_mips64" "webdav_mips64-linux-muslabi64" | |
| pack "release/bin/webdav_linux_mips64el" "webdav_mips64el-linux-muslabi64" | |
| pack "release/bin/webdav_linux_mips64n32" "webdav_mips64-linux-muslabin32" | |
| pack "release/bin/webdav_linux_mips64eln32" "webdav_mips64el-linux-muslabin32" | |
| pack "release/bin/webdav_macos_x86_64" "webdav_x86_64-macos" | |
| pack "release/bin/webdav_macos_arm64" "webdav_aarch64-macos" | |
| pack "release/bin/webdav_windows_x86.exe" "webdav_x86-windows-gnu" | |
| pack "release/bin/webdav_windows_amd64.exe" "webdav_x86_64-windows-gnu" | |
| pack "release/bin/webdav_windows_arm64.exe" "webdav_aarch64-windows-gnu" | |
| pack "release/bin/webdav_freebsd_x86_64" "webdav_x86_64-freebsd" | |
| pack "release/bin/webdav_freebsd_arm64" "webdav_aarch64-freebsd" | |
| pack "release/bin/webdav_x86_64-unknown-cosmo.com" "webdav_x86_64-unknown-cosmo" | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: webdav-target-archives-${{ github.sha }} | |
| path: dist/*.tar.gz | |
| if-no-files-found: error | |
| - name: Publish artifact in GitHub Release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/*.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |