diff --git a/.gitea/workflows/desktop-release.yml b/.gitea/workflows/desktop-release.yml new file mode 100644 index 0000000..05bc891 --- /dev/null +++ b/.gitea/workflows/desktop-release.yml @@ -0,0 +1,202 @@ +name: Desktop Release + +on: + push: + branches: [main] + tags: + - "v*" + workflow_dispatch: + +permissions: + code: read + releases: read + +jobs: + windows-nsis: + name: Windows x64 NSIS + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + + - uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-pc-windows-msvc + + - name: Install Windows cross-build tools + run: | + sudo apt-get update + sudo apt-get install -y nsis lld llvm clang + cargo install --locked cargo-xwin + + - name: Install Node dependencies + run: npm install + + - name: Build Windows installer + run: npm run bundle:windows + env: + XWIN_CACHE_DIR: ${{ runner.temp }}/xwin-cache + + - name: Stage Windows installer + shell: bash + run: | + set -euo pipefail + source_file="$(find src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis -maxdepth 1 -type f -name '*-setup.exe' -print -quit)" + test -n "$source_file" + mkdir -p dist + cp "$source_file" dist/fieldlens-print-windows-x64-setup.exe + + - uses: actions/upload-artifact@v3 + with: + name: fieldlens-print-windows-x64 + path: dist/fieldlens-print-windows-x64-setup.exe + if-no-files-found: error + retention-days: 14 + + linux-deb: + name: Linux x64 DEB + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + + - uses: dtolnay/rust-toolchain@stable + + - name: Install Tauri Linux prerequisites + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + curl \ + wget \ + file \ + libwebkit2gtk-4.1-dev \ + libxdo-dev \ + libssl-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev \ + patchelf + + - name: Install Node dependencies + run: npm install + + - name: Build Debian package + run: npm run bundle:deb + + - name: Stage Debian package + shell: bash + run: | + set -euo pipefail + source_file="$(find src-tauri/target/release/bundle/deb -maxdepth 1 -type f -name '*.deb' -print -quit)" + test -n "$source_file" + mkdir -p dist + cp "$source_file" dist/fieldlens-print-linux-x64.deb + + - uses: actions/upload-artifact@v3 + with: + name: fieldlens-print-linux-x64-deb + path: dist/fieldlens-print-linux-x64.deb + if-no-files-found: error + retention-days: 14 + + publish-release: + name: Publish public desktop release + needs: [windows-nsis, linux-deb] + runs-on: ubuntu-latest + permissions: + code: read + releases: write + steps: + - uses: actions/checkout@v4 + + - name: Resolve release tag + id: release + shell: bash + run: | + if [[ "${GITEA_REF}" == refs/tags/* ]]; then + tag="${GITEA_REF_NAME}" + else + version="$(node -p "require('./package.json').version")" + tag="v${version}" + fi + echo "tag=${tag}" >> "$GITEA_OUTPUT" + env: + GITEA_REF: ${{ gitea.ref }} + GITEA_REF_NAME: ${{ gitea.ref_name }} + + - uses: actions/download-artifact@v3 + with: + name: fieldlens-print-windows-x64 + path: release-assets + + - uses: actions/download-artifact@v3 + with: + name: fieldlens-print-linux-x64-deb + path: release-assets + + - name: Publish Gitea release assets + shell: bash + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + GITEA_SERVER_URL: ${{ gitea.server_url }} + GITEA_REPOSITORY: ${{ gitea.repository }} + GITEA_SHA: ${{ gitea.sha }} + RELEASE_TAG: ${{ steps.release.outputs.tag }} + run: | + set -euo pipefail + + api="${GITEA_SERVER_URL%/}/api/v1/repos/${GITEA_REPOSITORY}" + auth_header="Authorization: token ${GITEA_TOKEN}" + + status="$(curl -sS -o /tmp/release.json -w '%{http_code}' \ + -H "$auth_header" \ + "$api/releases/tags/$RELEASE_TAG")" + + if [ "$status" = "404" ]; then + jq -n \ + --arg tag "$RELEASE_TAG" \ + --arg sha "$GITEA_SHA" \ + '{ + tag_name: $tag, + target_commitish: $sha, + name: ("FieldLens Print " + $tag), + body: "Public FieldLens Print desktop installers.", + draft: false, + prerelease: false + }' > /tmp/create-release.json + + curl -fsS \ + -X POST \ + -H "$auth_header" \ + -H "Content-Type: application/json" \ + --data-binary @/tmp/create-release.json \ + "$api/releases" > /tmp/release.json + elif [ "$status" != "200" ]; then + cat /tmp/release.json + exit 1 + fi + + release_id="$(jq -r '.id' /tmp/release.json)" + test "$release_id" != "null" + + curl -fsS -H "$auth_header" "$api/releases/$release_id/assets" > /tmp/assets.json + + for file in release-assets/fieldlens-print-windows-x64-setup.exe release-assets/fieldlens-print-linux-x64.deb; do + name="$(basename "$file")" + existing_id="$(jq -r --arg name "$name" '.[] | select(.name == $name) | .id' /tmp/assets.json | head -n 1)" + if [ -n "$existing_id" ] && [ "$existing_id" != "null" ]; then + curl -fsS -X DELETE -H "$auth_header" "$api/releases/$release_id/assets/$existing_id" + fi + + curl -fsS \ + -X POST \ + -H "$auth_header" \ + -F "attachment=@$file" \ + "$api/releases/$release_id/assets?name=$name" + done diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b579482 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +dist/ +src-tauri/target/ +src-tauri/icons/ diff --git a/README.md b/README.md index 832f528..aedf742 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,29 @@ -# fieldlens-desktop +# FieldLens Desktop -FieldLens Print desktop client builds and public release assets \ No newline at end of file +Public build and release mirror for **FieldLens Print**. + +The private `Admin/fieldlens` repository remains the source of truth. This repository contains only the desktop client needed to build public Windows and Linux installers. + +## Releases + +A push to `main` builds: + +- `fieldlens-print-windows-x64-setup.exe` +- `fieldlens-print-linux-x64.deb` + +The workflow publishes them to the Gitea release matching the version in `package.json`. + +## Local build + +```bash +npm install +npm run build +npm run bundle:deb +``` + +Windows cross-build: + +```bash +cargo install --locked cargo-xwin +npm run bundle:windows +``` diff --git a/app-icon.svg b/app-icon.svg new file mode 100644 index 0000000..13af2f7 --- /dev/null +++ b/app-icon.svg @@ -0,0 +1,17 @@ + diff --git a/index.html b/index.html new file mode 100644 index 0000000..37a6a91 --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + +
+ + + +