|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build-windows: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v4 |
| 11 | + with: |
| 12 | + ref: 2.0.5-final |
| 13 | + - name: Set up JDK 17 |
| 14 | + uses: actions/setup-java@v4 |
| 15 | + with: |
| 16 | + java-version: '17' |
| 17 | + distribution: 'temurin' |
| 18 | + - name: Install API to local repo |
| 19 | + run: mvn -B -pl API install -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" |
| 20 | + - name: Build API fat JAR (Windows) |
| 21 | + run: mvn -B -pl API -P complete-win-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" |
| 22 | + - name: Build IDE fat JAR (Windows) |
| 23 | + run: mvn -B -pl IDE -P complete-win-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" |
| 24 | + - name: Upload artifacts |
| 25 | + uses: actions/upload-artifact@v4 |
| 26 | + with: |
| 27 | + name: windows-jars |
| 28 | + path: | |
| 29 | + API/target/*complete-win*.jar |
| 30 | + IDE/target/*complete-win*.jar |
| 31 | +
|
| 32 | + build-macos: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + ref: 2.0.5-final |
| 38 | + - name: Set up JDK 17 |
| 39 | + uses: actions/setup-java@v4 |
| 40 | + with: |
| 41 | + java-version: '17' |
| 42 | + distribution: 'temurin' |
| 43 | + - name: Install API to local repo |
| 44 | + run: mvn -B -pl API install -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" |
| 45 | + - name: Build API fat JAR (macOS) |
| 46 | + run: mvn -B -pl API -P complete-mac-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" |
| 47 | + - name: Build IDE fat JAR (macOS) |
| 48 | + run: mvn -B -pl IDE -P complete-mac-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" |
| 49 | + - name: Upload artifacts |
| 50 | + uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: macos-jars |
| 53 | + path: | |
| 54 | + API/target/*complete-mac*.jar |
| 55 | + IDE/target/*complete-mac*.jar |
| 56 | +
|
| 57 | + build-linux: |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + with: |
| 62 | + ref: 2.0.5-final |
| 63 | + - name: Set up JDK 17 |
| 64 | + uses: actions/setup-java@v4 |
| 65 | + with: |
| 66 | + java-version: '17' |
| 67 | + distribution: 'temurin' |
| 68 | + - name: Install API to local repo |
| 69 | + run: mvn -B -pl API install -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" |
| 70 | + - name: Build API fat JAR (Linux) |
| 71 | + run: mvn -B -pl API -P complete-lux-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" |
| 72 | + - name: Build IDE fat JAR (Linux) |
| 73 | + run: mvn -B -pl IDE -P complete-lux-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" |
| 74 | + - name: Upload artifacts |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: linux-jars |
| 78 | + path: | |
| 79 | + API/target/*complete-lux*.jar |
| 80 | + IDE/target/*complete-lux*.jar |
| 81 | +
|
| 82 | + release: |
| 83 | + needs: [build-windows, build-macos, build-linux] |
| 84 | + runs-on: ubuntu-latest |
| 85 | + permissions: |
| 86 | + contents: write |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + ref: 2.0.5-final |
| 91 | + |
| 92 | + - name: Get version from POM |
| 93 | + id: version |
| 94 | + run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT |
| 95 | + |
| 96 | + - name: Download all artifacts |
| 97 | + uses: actions/download-artifact@v4 |
| 98 | + |
| 99 | + - name: List downloaded artifacts |
| 100 | + run: find . -name "*.jar" -not -path "./.m2/*" | sort |
| 101 | + |
| 102 | + - name: Prepare release assets |
| 103 | + run: | |
| 104 | + VERSION="${{ steps.version.outputs.VERSION }}" |
| 105 | + mkdir -p release-assets |
| 106 | + find windows-jars -name "*complete-win*" -exec cp {} release-assets/ \; |
| 107 | + find macos-jars -name "*complete-mac*" -exec cp {} release-assets/ \; |
| 108 | + find linux-jars -name "*complete-lux*" -exec cp {} release-assets/ \; |
| 109 | + cd release-assets |
| 110 | + for f in *-complete-win.jar; do mv "$f" "${f%-complete-win.jar}-windows.jar"; done |
| 111 | + for f in *-complete-mac.jar; do mv "$f" "${f%-complete-mac.jar}-macos.jar"; done |
| 112 | + for f in *-complete-lux.jar; do mv "$f" "${f%-complete-lux.jar}-linux.jar"; done |
| 113 | + echo "=== Release assets ===" |
| 114 | + ls -lh |
| 115 | +
|
| 116 | + - name: Create release if it does not exist |
| 117 | + env: |
| 118 | + GH_TOKEN: ${{ github.token }} |
| 119 | + run: | |
| 120 | + TAG="v${{ steps.version.outputs.VERSION }}" |
| 121 | + if ! gh release view "$TAG" > /dev/null 2>&1; then |
| 122 | + gh release create "$TAG" \ |
| 123 | + --title "SikuliX ${{ steps.version.outputs.VERSION }}" \ |
| 124 | + --notes "SikuliX ${{ steps.version.outputs.VERSION }} — built with Java 17, OpenCV 4.5.1. Maintenance transferred to oculix-org." \ |
| 125 | + --target master |
| 126 | + fi |
| 127 | +
|
| 128 | + - name: Upload assets to release |
| 129 | + env: |
| 130 | + GH_TOKEN: ${{ github.token }} |
| 131 | + run: | |
| 132 | + TAG="v${{ steps.version.outputs.VERSION }}" |
| 133 | + gh release upload "$TAG" release-assets/*.jar --clobber |
0 commit comments