name: Build Release on: push: tags: - 'v*' workflow_dispatch: jobs: build-windows: name: Build Windows runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Rust run: | rustup toolchain install stable --profile minimal --target x86_64-pc-windows-gnu rustup target add x86_64-pc-windows-gnu cargo install --target x86_64-pc-windows-gnu cross 2>&1 || true - name: Install MinGW run: | sudo apt-get update sudo apt-get install -y mingw-w64 x86_64-w64-mingw32-posix-runtime - name: Build env: CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc run: | cargo build --release --target x86_64-pc-windows-gnu - name: Package run: | mkdir -p dist cp target/x86_64-pc-windows-gnu/release/readflow.exe dist/ cd dist zip -r -q readflow-windows-x86_64.zip readflow.exe echo "ReadFlow Windows x86_64" > README.txt echo "Build completed at $(date)" >> README.txt zip -r -q readflow-windows-x86_64.zip README.txt - name: Upload to Release run: | TAG="${{ github.ref_name }}" TOKEN="${{ secrets.GITEA_TOKEN }}" # Get or create release RELEASE_ID=$(curl -s -X POST "http://192.168.120.110:4000/api/v1/repos/damai/readflow/releases" \ -H "Authorization: token ${TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\": \"${TAG}\", \"name\": \"ReadFlow ${TAG}\", \"draft\": false, \"prerelease\": false}" \ | jq -r '.id') if [ "$RELEASE_ID" != "null" ]; then echo "Release exists: ${RELEASE_ID}" else echo "Creating new release" fi # Upload asset curl -s -X POST "http://192.168.120.110:4000/api/v1/repos/damai/readflow/releases/${RELEASE_ID}/assets" \ -H "Authorization: token ${TOKEN}" \ -H "Content-Type: application/zip" \ --data-binary @dist/readflow-windows-x86_64.zip