Deploy to Maven #6
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: Deploy to Maven | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| validation: | |
| name: "Validation" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: gradle/actions/wrapper-validation@v4 | |
| build-docker: | |
| needs: [validation] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - container: wpilib/roborio-cross-ubuntu:2025-22.04 | |
| artifact-name: Athena | |
| build-options: "-Ponlylinuxathena" | |
| - container: wpilib/raspbian-cross-ubuntu:bookworm-22.04 | |
| artifact-name: Arm32 | |
| build-options: "-Ponlylinuxarm32" | |
| - container: wpilib/aarch64-cross-ubuntu:bookworm-22.04 | |
| artifact-name: Arm64 | |
| build-options: "-Ponlylinuxarm64" | |
| - container: wpilib/ubuntu-base:22.04 | |
| artifact-name: Linux | |
| build-options: "" | |
| name: "Build - ${{ matrix.artifact-name }}" | |
| runs-on: ubuntu-22.04 | |
| container: ${{ matrix.container }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Fetch all history and metadata | |
| run: | | |
| git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| cache-read-only: false | |
| - name: Build with Gradle | |
| run: ./gradlew build ${{ matrix.build-options }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact-name }} | |
| path: build/allOutputs | |
| build-host: | |
| needs: [validation] | |
| env: | |
| MACOSX_DEPLOYMENT_TARGET: 13.3 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-2022 | |
| artifact-name: Win64 | |
| architecture: x64 | |
| - os: macos-14 | |
| artifact-name: macOS | |
| architecture: aarch64 | |
| name: "Build - ${{ matrix.artifact-name }}" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Fetch all history and metadata | |
| run: git fetch --prune --unshallow | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| architecture: ${{ matrix.architecture }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| cache-read-only: false | |
| - name: Build with Gradle | |
| run: ./gradlew build -Pbuildalldesktop | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact-name }} | |
| path: build/allOutputs | |
| combine: | |
| name: Combine Artifacts | |
| needs: [build-docker, build-host] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: wpilibsuite/build-tools | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: combiner/products/build/allOutputs | |
| - name: Flatten Artifacts | |
| run: rsync -a --delete combiner/products/build/allOutputs/*/* combiner/products/build/allOutputs/ | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| cache-read-only: false | |
| - name: Combine | |
| run: ./gradlew publish -Pthirdparty | |
| working-directory: combiner | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Maven | |
| path: ~/releases | |
| publish-to-r2: | |
| name: Publish to R2 | |
| needs: [combine] | |
| runs-on: ubuntu-22.04 | |
| environment: main | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: Maven | |
| path: maven-repo | |
| - name: Deploy to R2 | |
| uses: ryand56/r2-upload-action@latest | |
| with: | |
| r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} | |
| r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} | |
| r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
| r2-bucket: ${{ secrets.R2_BUCKET_NAME }} | |
| source-dir: maven-repo | |
| destination-dir: ./ | |
| - name: Summary | |
| run: | | |
| echo "Deployed to R2 bucket at $(date)" | |
| echo "Maven repository URL: ${{ secrets.R2_PUBLIC_URL }}" |