diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 92000a5..bc9e21a 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -134,3 +134,46 @@ jobs: src-tauri/target/release/bundle/dmg/*.dmg src-tauri/target/release/bundle/macos/*.app retention-days: 30 + + release: + name: Create Release + needs: build-tauri + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Download all app artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts/ + pattern: app-* + + - name: Generate release tag + id: tag + run: echo "tag=build-$(date +%Y%m%d-%H%M%S)" >> $GITHUB_OUTPUT + + - name: Create release + env: + BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} + TAG: ${{ steps.tag.outputs.tag }} + run: | + # Create the release + RELEASE_ID=$(curl -s -X POST \ + -H "Authorization: token ${BUILD_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\": \"${TAG}\", \"name\": \"Voice to Notes ${TAG}\", \"body\": \"Automated build from main branch.\", \"draft\": false, \"prerelease\": true}" \ + "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases" | jq -r '.id') + + echo "Release ID: ${RELEASE_ID}" + + # Upload all artifacts + find artifacts/ -type f \( -name "*.deb" -o -name "*.AppImage" -o -name "*.msi" -o -name "*.exe" -o -name "*.dmg" \) | while read file; do + filename=$(basename "$file") + echo "Uploading ${filename}..." + curl -s -X POST \ + -H "Authorization: token ${BUILD_TOKEN}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@${file}" \ + "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${filename}" + done