fork/static-web-server
git clone https://git.julia.blue/fork/static-web-server
ee4b049
allow-symlink
1name : release 2on : 3push : 4tags : 5- 'v2.[0-9]+.[0-9]+' 6- 'v2.[0-9]+.[0-9]+-beta.[0-9]+' 7 8jobs : 9create-release : 10name : create-release 11runs-on : ubuntu-22.04 12outputs : 13sws_version : ${{ env.SWS_VERSION }} 14steps : 15- name : Get the release version from the tag 16shell : bash 17if : env.SWS_VERSION == '' 18run : | 19# Apparently, this is the right way to get a tag name. Really? 20# 21# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 22echo "SWS_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV 23echo "version is: ${{ env.SWS_VERSION }}" 24- name : Checkout repository 25uses : actions/checkout@v4 26with : 27fetch-depth : 1 28- name : Create GitHub release 29env : 30GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} 31run : | 32gh release create ${{ env.SWS_VERSION }} --verify-tag --draft --title="${{ env.SWS_VERSION }}" 33 34build-release : 35name : build-release 36needs : [ 'create-release' ] 37runs-on : ${{ matrix.os }} 38env : 39# For some builds, we use cross to test on 32-bit and big-endian 40# systems. 41CARGO_BIN : cargo 42# When CARGO_BIN is set to CROSS, this is set to `--target matrix.target`. 43TARGET_FLAGS : "" 44# When CARGO_BIN is set to CROSS, TARGET_DIR includes matrix.target. 45TARGET_DIR : ./target 46# Emit backtraces on panics. 47RUST_BACKTRACE : 1 48# SWS features for Cargo build 49CARGO_FEATURES : "--features=all" 50strategy : 51matrix : 52build : 53- linux-musl 54- linux-musl-arm64 55- linux-musl-i686 56- linux-gnu 57- linux-gnu-arm64 58- linux-gnu-i686 59- linux-arm-gnueabihf 60- linux-musl-armv6 61- linux-musl-armv7 62- linux-gnu-armv7 63- linux-ppc64le 64- linux-s390x 65# - linux-android-armv7 66- linux-android-arm64 67- netbsd 68- illumos 69- macos 70- macos-arm64 71- windows-msvc 72- windows-msvc-i686 73- windows-msvc-arm64 74- windows-pc-gnu 75include : 76- build : linux-musl 77os : ubuntu-22.04 78rust : stable 79target : x86_64-unknown-linux-musl 80- build : linux-musl-i686 81os : ubuntu-22.04 82rust : stable 83target : i686-unknown-linux-musl 84- build : linux-musl-arm64 85os : ubuntu-22.04 86rust : stable 87target : aarch64-unknown-linux-musl 88- build : linux-gnu 89os : ubuntu-22.04 90rust : stable 91target : x86_64-unknown-linux-gnu 92- build : linux-gnu-i686 93os : ubuntu-22.04 94rust : stable 95target : i686-unknown-linux-gnu 96- build : linux-gnu-arm64 97os : ubuntu-22.04 98rust : stable 99target : aarch64-unknown-linux-gnu 100- build : linux-arm-gnueabihf 101os : ubuntu-22.04 102rust : stable 103target : arm-unknown-linux-gnueabihf 104- build : linux-musl-armv6 105os : ubuntu-22.04 106rust : stable 107target : arm-unknown-linux-musleabihf 108- build : linux-musl-armv7 109os : ubuntu-22.04 110rust : stable 111target : armv7-unknown-linux-musleabihf 112- build : linux-gnu-armv7 113os : ubuntu-22.04 114rust : stable 115target : armv7-unknown-linux-gnueabihf 116- build : linux-ppc64le 117os : ubuntu-22.04 118rust : stable 119target : powerpc64le-unknown-linux-gnu 120- build : linux-s390x 121os : ubuntu-22.04 122rust : stable 123target : s390x-unknown-linux-gnu 124# - build: linux-android-armv7 125# os: ubuntu-22.04 126# rust: stable 127# target: armv7-linux-androideabi 128- build : linux-android-arm64 129os : ubuntu-22.04 130rust : stable 131target : aarch64-linux-android 132- build : netbsd 133os : ubuntu-22.04 134rust : stable 135target : x86_64-unknown-netbsd 136- build : illumos 137os : ubuntu-22.04 138rust : stable 139target : x86_64-unknown-illumos 140- build : macos 141os : macos-14 142rust : stable 143target : x86_64-apple-darwin 144- build : macos-arm64 145os : macos-14 146rust : stable 147target : aarch64-apple-darwin 148- build : windows-msvc 149os : windows-2022 150rust : stable 151target : x86_64-pc-windows-msvc 152- build : windows-msvc-i686 153os : windows-2022 154rust : stable 155target : i686-pc-windows-msvc 156- build : windows-msvc-arm64 157os : windows-2022 158rust : stable 159target : aarch64-pc-windows-msvc 160- build : windows-pc-gnu 161os : windows-2022 162rust : stable 163target : x86_64-pc-windows-gnu 164 165steps : 166- name : Checkout repository 167uses : actions/checkout@v4 168with : 169fetch-depth : 1 170 171- name : Install Linux/BSD tools 172if : ${{ !contains(matrix.os, 'windows') }} 173run : scripts/ci/install_tools.sh --target=${{ matrix.target }} 174 175- name : Install Rust 176uses : dtolnay/rust-toolchain@stable 177with : 178toolchain : ${{ matrix.rust }} 179target : ${{ matrix.target }} 180 181- name : Set up Cross 182shell : bash 183run : | 184if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then 185# Use 'cargo.sh' script for Android targets only 186if [[ "${{ matrix.build }}" == "linux-android-armv7" ]] || [[ "${{ matrix.build }}" == "linux-android-arm64" ]]; then 187echo "CARGO_BIN=scripts/ci/cargo.sh" >> $GITHUB_ENV 188else 189target='' 190case "${{ matrix.os }}" in 191*macos*) 192target=x86_64-apple-darwin 193;; 194*) 195target=x86_64-unknown-linux-musl 196;; 197esac 198 199echo "Installing cross..." 200curl -sSL \ 201"https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-$target.tar.gz" \ 202| sudo tar zxf - -C /usr/local/bin/ cross cross-util 203cross -V 204echo "CARGO_BIN=/usr/local/bin/cross" >> $GITHUB_ENV 205fi 206fi 207echo "TARGET_FLAGS=--target=${{ matrix.target }}" >> $GITHUB_ENV 208echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV 209 210- name : Setup Windows ARM64 211if : ${{ contains(matrix.build, 'windows-msvc-arm64') }} 212run : | 213# ring crate: add Visual Studio Build Tools "VS 2022 C++ ARM64 build tools" and "clang" components 214$env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin" 215 216- name : Show command used for Cargo 217run : | 218echo "cargo command is: ${{ env.CARGO_BIN }}" 219echo "target flag is: ${{ env.TARGET_FLAGS }}" 220echo "target dir is: ${{ env.TARGET_DIR }}" 221 222- name : Build release binary 223run : ${{ env.CARGO_BIN }} build --bin static-web-server -vv --release ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} 224 225- name : Build archive 226shell : bash 227run : | 228staging="static-web-server-${{ needs.create-release.outputs.sws_version }}-${{ matrix.target }}" 229mkdir -p "$staging/" 230mkdir -p bin 231 232cp {README.md,LICENSE-APACHE,LICENSE-MIT} "$staging/" 233 234if [ "${{ matrix.os }}" = "windows-2022" ]; then 235cp "target/${{ matrix.target }}/release/static-web-server.exe" "$staging/" 2367z a "$staging.zip" "$staging" 237echo "ASSET=$staging.zip" >> $GITHUB_ENV 238else 239# The man page is only generated on Unix systems. 240cp "target/${{ matrix.target }}/release/static-web-server" "$staging/" 241cp "$staging/static-web-server" bin/ 242tar czf "$staging.tar.gz" "$staging" 243echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV 244fi 245 246- name : Upload release archive 247env : 248GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} 249run : | 250 gh release upload ${{ needs.create-release.outputs.sws_version }} ${{ env.ASSET }}