# Release builds on git.b4l.co.th (Gitea Actions). # # On a v* tag: tests, then the Linux and Windows x86_64 binaries (desktop app # and web version), packaged and attached to the tag's release (created when # missing, text from CHANGELOG.md). On demand (workflow_dispatch) the same # packages become the artifact `nfc-writer-packages` instead. # # Linux is built on ubuntu-22.04 so the binary needs only glibc 2.35 (Debian 12, # Ubuntu 22.04 and newer). Windows is cross-built with MinGW-w64. macOS has no # runner here: build it on a Mac (README, "Build and run"). name: Release on: push: tags: ['v*'] workflow_dispatch: env: CARGO_TERM_COLOR: always RUST_TOOLCHAIN: "1.98.1" jobs: release: runs-on: ubuntu-22.04 timeout-minutes: 60 permissions: contents: write steps: - uses: actions/checkout@v4 - name: System packages run: | SUDO=$(command -v sudo || true) $SUDO apt-get update -qq $SUDO apt-get install -y -qq curl ca-certificates gcc libc6-dev pkg-config \ libpcsclite-dev gcc-mingw-w64-x86-64 zip python3 - name: Rust toolchain run: | if ! command -v rustup >/dev/null && [ ! -x "$HOME/.cargo/bin/rustup" ]; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none fi export PATH="$HOME/.cargo/bin:$PATH" echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal -c clippy -t x86_64-pc-windows-gnu rustup default "$RUST_TOOLCHAIN" rustc --version - name: Tests and clippy run: | cargo test --locked cargo clippy --locked --all-targets -- -D warnings - name: Build run: | cargo build --locked --release cargo build --locked --release --target x86_64-pc-windows-gnu - name: Package run: | case "$GITHUB_REF" in refs/tags/*) version="$GITHUB_REF_NAME" ;; *) version="dev-${GITHUB_SHA::7}" ;; esac mkdir -p dist linux="nfc-writer-$version-linux-x86_64" mkdir "$linux" cp target/release/nfc-writer target/release/nfc-writer-web README.md "$linux/" tar czf "dist/$linux.tar.gz" "$linux" windows="nfc-writer-$version-windows-x86_64" mkdir "$windows" cp target/x86_64-pc-windows-gnu/release/nfc-writer.exe \ target/x86_64-pc-windows-gnu/release/nfc-writer-web.exe README.md "$windows/" zip -qr "dist/$windows.zip" "$windows" ls -l dist - name: Attach to the release if: startsWith(github.ref, 'refs/tags/v') env: TOKEN: ${{ secrets.GITEA_TOKEN }} run: python3 .gitea/scripts/release-attach.py dist/* - name: Artifact (on-demand runs) if: "!startsWith(github.ref, 'refs/tags/v')" uses: https://github.com/christopherHX/gitea-upload-artifact@v4 with: name: nfc-writer-packages path: dist/