Build and Deploy #260
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy | |
| on: | |
| schedule: | |
| - cron: "0 11 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| isDeploy: | |
| description: "Whether the build should be deployed?" | |
| type: boolean | |
| required: true | |
| default: false | |
| skipBinaries: | |
| description: "Skip building precompiled binaries?" | |
| type: boolean | |
| required: true | |
| default: false | |
| skipJava: | |
| description: "Skip building Java?" | |
| type: boolean | |
| required: true | |
| default: false | |
| skipNodejs: | |
| description: "Skip building Node.js?" | |
| type: boolean | |
| required: true | |
| default: false | |
| skipWasm: | |
| description: "Skip building WebAssembly?" | |
| type: boolean | |
| required: true | |
| default: false | |
| skipPython: | |
| description: "Skip building Python?" | |
| type: boolean | |
| required: true | |
| default: false | |
| skipRust: | |
| description: "Skip building Rust?" | |
| type: boolean | |
| required: true | |
| default: false | |
| skipExtensions: | |
| description: "Skip building extensions?" | |
| type: boolean | |
| required: true | |
| default: true | |
| isNightly: | |
| description: "Whether the build is a nightly build?" | |
| type: boolean | |
| required: true | |
| default: false | |
| env: | |
| PIP_BREAK_SYSTEM_PACKAGES: 1 | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| packages: write # Required by extension deployment | |
| jobs: | |
| get-nightly-version: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| run: python3 -m pip install uv | |
| - name: Update nightly version | |
| run: | | |
| uv venv | |
| source .venv/bin/activate | |
| uv pip install packaging | |
| python3 update-nightly-build-version.py | grep "New Python dev version:" | awk -F'New Python dev version: ' '{print $2}' | sed 's/\.$//' > version.txt | |
| cat version.txt | |
| working-directory: scripts | |
| - name: Upload version | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: version | |
| path: scripts/version.txt | |
| build-extension: | |
| if: ${{ github.event_name == 'schedule' && github.event.inputs.skipExtensions != 'true' }} | |
| uses: ./.github/workflows/build-and-deploy-extension.yml | |
| with: | |
| isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| secrets: inherit | |
| build-wheels: | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipPython != 'true' }} | |
| uses: ./.github/workflows/python-wheel-workflow.yml | |
| with: | |
| isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| secrets: inherit | |
| deploy-python: | |
| permissions: | |
| id-token: write | |
| environment: | |
| name: pypi | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipPython != 'true' }} | |
| needs: build-wheels | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-wheels-arm64 | |
| path: dist | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-wheels-x86_64 | |
| path: dist | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: manylinux_2_28-wheels-x86_64 | |
| path: dist | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: manylinux_2_28-wheels-aarch64 | |
| path: dist | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-wheels-amd64 | |
| path: dist | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-wheels-arm64 | |
| path: dist | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: python-sdist | |
| path: dist | |
| - name: List wheels | |
| run: ls -l | |
| working-directory: dist | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lbug-deploy-wheels | |
| path: dist/* | |
| - name: Deploy to PyPI test | |
| if: ${{ github.event_name != 'workflow_dispatch' && github.event.inputs.isDeploy != 'true' }} | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| skip-existing: true | |
| - name: Deploy to PyPI | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.isDeploy == 'true' }} | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| deploy-rust: | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipRust != 'true' }} | |
| runs-on: ubuntu-latest | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| run: pip3 install uv | |
| - name: Update nightly version | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| run: | | |
| uv venv | |
| source .venv/bin/activate | |
| uv pip install packaging | |
| python3 update-nightly-build-version.py | |
| working-directory: scripts | |
| - name: Update Cargo.toml version | |
| run: python3 update_version.py | |
| working-directory: tools/rust_api | |
| - name: Deploy crate to Crates.io | |
| run: cargo publish --allow-dirty | |
| if: ${{ github.event.inputs.isDeploy == 'true' }} | |
| working-directory: tools/rust_api | |
| - name: Test publishing crate | |
| run: cargo publish --dry-run --allow-dirty | |
| if: ${{ github.event.inputs.isDeploy != 'true' }} | |
| working-directory: tools/rust_api | |
| - name: Upload crate | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lbug-deploy-crate | |
| path: tools/rust_api/target/package/*.crate | |
| build-java: | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipJava != 'true' }} | |
| uses: ./.github/workflows/java-workflow.yml | |
| with: | |
| isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| secrets: inherit | |
| deploy-java: | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipJava != 'true' }} | |
| needs: [build-java] | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GPG_SIGNING_KEY: ${{ secrets.PGP_PRIVATE_KEY }} | |
| GPG_SIGNING_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
| SKIP_CMAKE_BUILD: true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| run: python3 -m pip install uv | |
| - name: Update nightly version | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| run: | | |
| uv venv | |
| source .venv/bin/activate | |
| uv pip install packaging | |
| python3 update-nightly-build-version.py | |
| working-directory: scripts | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-osx-arm64 | |
| path: tools/java_api/src/main/resources | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-linux-aarch64 | |
| path: tools/java_api/src/main/resources | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-linux-x86_64 | |
| path: tools/java_api/src/main/resources | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: java-lib-win-x86_64 | |
| path: tools/java_api/src/main/resources | |
| - name: Create Java JAR | |
| working-directory: tools/java_api | |
| run: | | |
| ./gradlew build | |
| - name: Upload Java JAR | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lbug-java-multiplatform-jar | |
| path: tools/java_api/build/libs/lbug*.jar | |
| - name: Create Maven Central bundle | |
| working-directory: tools/java_api | |
| run: | | |
| ORIGINAL_PWD=$(pwd) | |
| ./gradlew publishMavenJavaToLocalRepo -i | |
| cd build/repo | |
| zip -r lbug-java-bundle.zip com | |
| mv lbug-java-bundle.zip $ORIGINAL_PWD | |
| - name: Upload Maven Central bundle | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lbug-java-multiplatform-bundle | |
| path: tools/java_api/lbug-java-bundle.zip | |
| - name: Deploy to Maven Central | |
| if: ${{ github.event.inputs.isDeploy == 'true' && github.event.inputs.isNightly != 'true' }} | |
| working-directory: tools/java_api | |
| run: | | |
| curl --request POST \ | |
| --verbose \ | |
| --header 'Authorization: Bearer ${{ secrets.MAVEN_CENTRAL_PORTAL_TOKEN }}' \ | |
| --form bundle=@lbug-java-bundle.zip \ | |
| https://central.sonatype.com/api/v1/publisher/upload?publishingType=AUTOMATIC | |
| - name: Publish to GitHub Packages | |
| if: ${{ github.event.inputs.isDeploy == 'true' || github.event_name == 'schedule' }} | |
| working-directory: tools/java_api | |
| run: | | |
| ./gradlew publish -i | |
| build-nodejs: | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipNodejs != 'true' }} | |
| uses: ./.github/workflows/nodejs-workflow.yml | |
| with: | |
| isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| secrets: inherit | |
| deploy-nodejs: | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipNodejs != 'true' }} | |
| needs: [build-nodejs] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| run: pip3 install uv | |
| - name: Update nightly version | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| run: | | |
| uv venv | |
| source .venv/bin/activate | |
| uv pip install packaging | |
| python3 update-nightly-build-version.py | |
| working-directory: scripts | |
| - name: Create prebuilt folder | |
| run: mkdir -p tools/nodejs_api/prebuilt | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: mac-nodejs-module-arm64 | |
| path: tools/nodejs_api/prebuilt | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-nodejs-module-x86_64 | |
| path: tools/nodejs_api/prebuilt | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-nodejs-module-aarch64 | |
| path: tools/nodejs_api/prebuilt | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-nodejs-module | |
| path: tools/nodejs_api/prebuilt | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Upgrade npm | |
| run: npm install -g npm@latest | |
| - name: Package Node.js API with prebuilt binaries | |
| run: node package | |
| working-directory: tools/nodejs_api | |
| - name: Show tarball contents | |
| run: tar -tvf lbug-source.tar.gz | |
| working-directory: tools/nodejs_api | |
| - name: Upload tarball | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lbug-deploy-nodejs | |
| path: tools/nodejs_api/lbug-source.tar.gz | |
| - name: Deploy to npm.js dry run | |
| if: ${{ github.event_name != 'schedule' && github.event.inputs.isDeploy != 'true' }} | |
| run: npm publish lbug-source.tar.gz --access public --dry-run | |
| working-directory: tools/nodejs_api | |
| - name: Deploy nightly to npm.js | |
| if: ${{ github.event_name == 'schedule' || (github.event.inputs.isDeploy == 'true' && github.event.inputs.isNightly == 'true') }} | |
| run: npm publish lbug-source.tar.gz --access public --tag next | |
| working-directory: tools/nodejs_api | |
| - name: Deploy to npm.js | |
| if: ${{ github.event.inputs.isDeploy == 'true' && github.event.inputs.isNightly != 'true' }} | |
| run: npm publish lbug-source.tar.gz --access public --tag latest | |
| working-directory: tools/nodejs_api | |
| build-and-test-wasm: | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipWasm != 'true' }} | |
| uses: ./.github/workflows/wasm-workflow.yml | |
| with: | |
| isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| secrets: inherit | |
| deploy-wasm: | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipWasm != 'true' }} | |
| needs: [build-and-test-wasm] | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_JS_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: lbug-deploy-wasm | |
| path: tools/wasm | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Show tarball contents | |
| run: tar -tvf lbug-wasm.tar.gz | |
| working-directory: tools/wasm | |
| - name: Deploy to npm.js dry run | |
| if: ${{ github.event_name != 'schedule' && github.event.inputs.isDeploy != 'true' }} | |
| run: npm publish lbug-wasm.tar.gz --access public --dry-run | |
| working-directory: tools/wasm | |
| - name: Deploy nightly to npm.js | |
| if: ${{ github.event_name == 'schedule' || (github.event.inputs.isDeploy == 'true' && github.event.inputs.isNightly == 'true') }} | |
| run: npm publish lbug-wasm.tar.gz --access public --tag next | |
| working-directory: tools/wasm | |
| - name: Deploy to npm.js | |
| if: ${{ github.event.inputs.isDeploy == 'true' && github.event.inputs.isNightly != 'true' }} | |
| run: npm publish lbug-wasm.tar.gz --access public --tag latest | |
| working-directory: tools/wasm | |
| build-precompiled-bin: | |
| if: ${{ github.event_name == 'schedule' || github.event.inputs.skipBinaries != 'true' }} | |
| uses: ./.github/workflows/precompiled-bin-workflow.yml | |
| with: | |
| isNightly: ${{ github.event_name == 'schedule' || github.event.inputs.isNightly == 'true' }} | |
| secrets: inherit |