desktop #245
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: desktop | |
| on: | |
| push: | |
| branches: | |
| - "release/**" | |
| - "fullbuild" | |
| - "desktopbuild" | |
| tags: | |
| - "v*" | |
| schedule: | |
| - cron: "17 1 * * *" | |
| jobs: | |
| build_linux_desktop_jar: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get GOVERSION content | |
| id: goversion | |
| run: echo "version=$(cat GOVERSION)" >> "$GITHUB_OUTPUT" | |
| - uses: magnetikonline/action-golang-cache@v4 | |
| with: | |
| go-version: "${{ steps.goversion.outputs.version }}" | |
| cache-key-suffix: "-windows-${{ steps.goversion.outputs.version }}" | |
| - run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - run: make DESKTOP/linux | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: oonimkall-linux.jar | |
| path: ./DESKTOP/oonimkall.jar | |
| build_darwin_desktop_jar: | |
| runs-on: macos-13 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get GOVERSION content | |
| id: goversion | |
| run: echo "version=$(cat GOVERSION)" >> "$GITHUB_OUTPUT" | |
| - uses: magnetikonline/action-golang-cache@v4 | |
| with: | |
| go-version: "${{ steps.goversion.outputs.version }}" | |
| cache-key-suffix: "-windows-${{ steps.goversion.outputs.version }}" | |
| - run: make DESKTOP/darwin | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: oonimkall-darwin.jar | |
| path: ./DESKTOP/oonimkall.jar | |
| build_windows_desktop_jar: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get GOVERSION content | |
| id: goversion | |
| run: echo "version=$(cat GOVERSION)" >> "$GITHUB_OUTPUT" | |
| - uses: magnetikonline/action-golang-cache@v4 | |
| with: | |
| go-version: "${{ steps.goversion.outputs.version }}" | |
| cache-key-suffix: "-windows-${{ steps.goversion.outputs.version }}" | |
| - name: Install oomobile | |
| run: | | |
| go install github.com/ooni/oomobile/cmd/gomobile@latest | |
| go install github.com/ooni/oomobile/cmd/gobind@latest | |
| go get github.com/ooni/oomobile/bind@latest | |
| - name: Init oomobile | |
| run: gomobile init | |
| - name: Run bind | |
| run: gomobile bind -target java/amd64 -o DESKTOP/oonimkall.jar ./pkg/oonimkall | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: oonimkall-windows.jar | |
| path: ./DESKTOP/oonimkall.jar | |
| merge_desktop_jar: | |
| runs-on: ubuntu-22.04 | |
| needs: | |
| - build_linux_desktop_jar | |
| - build_darwin_desktop_jar | |
| - build_windows_desktop_jar | |
| steps: | |
| - name: Download Linux JAR | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: oonimkall-linux.jar | |
| path: linux | |
| - name: Download Darwin JAR | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: oonimkall-darwin.jar | |
| path: darwin | |
| - name: Download Windows JAR | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: oonimkall-windows.jar | |
| path: windows | |
| - name: Unzip all JARs | |
| run: | | |
| mkdir -p merged | |
| unzip -q linux/oonimkall.jar -d merged | |
| unzip -q darwin/oonimkall.jar -d darwin_unzip | |
| unzip -q windows/oonimkall.jar -d windows_unzip | |
| - name: Copy Darwin native libs | |
| run: | | |
| cp -r darwin_unzip/jniLibs/amd64/*.dylib merged/jniLibs/amd64/ || true | |
| cp -r darwin_unzip/jniLibs/arm64/*.dylib merged/jniLibs/arm64/ || true | |
| - name: Copy Windows native libs | |
| run: | | |
| cp -r windows_unzip/jniLibs/amd64/* merged/jniLibs/amd64/ || true | |
| - name: Repack merged JAR | |
| run: | | |
| cd merged | |
| jar cf ../oonimkall-desktop.jar . | |
| - name: Upload merged multiplatform JAR | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: oonimkall-desktop.jar | |
| path: oonimkall-desktop.jar | |
| publish_desktop_jar_github: | |
| runs-on: ubuntu-22.04 | |
| needs: merge_desktop_jar | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: oonimkall-desktop.jar | |
| - name: Upload to Github | |
| run: ./script/ghpublish.bash oonimkall-desktop.jar | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish_desktop_jar_maven: | |
| runs-on: ubuntu-22.04 | |
| needs: merge_desktop_jar | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Download oonimkall-desktop JAR | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: oonimkall-desktop.jar | |
| path: MULTIPLATFORM | |
| - name: Set Project Version | |
| run: | | |
| if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| else | |
| SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-8) | |
| VERSION="${SHORT_SHA}" | |
| fi | |
| echo "Generated version: $VERSION" | |
| mvn -f MULTIPLATFORM/pom.xml versions:set -P deploy-desktop -DnewVersion=${VERSION}-desktop -DremoveSnapshot=true | |
| env: | |
| # Maven versions plugin might need GPG passphrase if it triggers a 'verify' phase. | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Publish to Maven Central | |
| run: | | |
| mvn -f MULTIPLATFORM/pom.xml clean deploy -P deploy-desktop --batch-mode -DskipTests | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |