diff --git a/.gitea/workflows/build-app.yml b/.gitea/workflows/build-app.yml index 2ded9f3..e3f9047 100644 --- a/.gitea/workflows/build-app.yml +++ b/.gitea/workflows/build-app.yml @@ -119,6 +119,90 @@ jobs: "${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${filename}" done + build-macos: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Compute version + id: version + run: | + COMMIT_COUNT=$(git rev-list --count HEAD) + VERSION="0.1.${COMMIT_COUNT}" + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + echo "Computed version: ${VERSION}" + + - name: Set app version + run: | + VERSION="${{ steps.version.outputs.VERSION }}" + sed -i '' "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/" app/src-tauri/tauri.conf.json + sed -i '' "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/" app/package.json + sed -i '' "s/^version = \".*\"/version = \"${VERSION}\"/" app/src-tauri/Cargo.toml + echo "Patched version to ${VERSION}" + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-apple-darwin,x86_64-apple-darwin + + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: "./app/src-tauri -> target" + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Install frontend dependencies + working-directory: ./app + run: npm ci + + - name: Install Tauri CLI + working-directory: ./app + run: npx tauri --version || npm install @tauri-apps/cli + + - name: Build Tauri app (universal) + working-directory: ./app + run: npx tauri build --target universal-apple-darwin + + - name: Collect artifacts + run: | + mkdir -p artifacts + cp app/src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg artifacts/ 2>/dev/null || true + cp app/src-tauri/target/universal-apple-darwin/release/bundle/macos/*.app.tar.gz artifacts/ 2>/dev/null || true + ls -la artifacts/ + + - name: Upload to Gitea release + if: gitea.event_name == 'push' + env: + TOKEN: ${{ secrets.REGISTRY_TOKEN }} + run: | + TAG="v${{ steps.version.outputs.VERSION }}-mac" + # Create release + curl -s -X POST \ + -H "Authorization: token ${TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\": \"${TAG}\", \"name\": \"Triple-C v${{ steps.version.outputs.VERSION }} (macOS)\", \"body\": \"Automated build from commit ${{ gitea.sha }}\"}" \ + "${GITEA_URL}/api/v1/repos/${REPO}/releases" > release.json + RELEASE_ID=$(cat release.json | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') + echo "Release ID: ${RELEASE_ID}" + # Upload each artifact + for file in artifacts/*; do + [ -f "$file" ] || continue + filename=$(basename "$file") + echo "Uploading ${filename}..." + curl -s -X POST \ + -H "Authorization: token ${TOKEN}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@${file}" \ + "${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${filename}" + done + build-windows: runs-on: windows-latest defaults: