Build and Release #1
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 Release | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-windows: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: 2.0.5-final | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Install API to local repo | |
| run: mvn -B -pl API install -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" | |
| - name: Build API fat JAR (Windows) | |
| run: mvn -B -pl API -P complete-win-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" | |
| - name: Build IDE fat JAR (Windows) | |
| run: mvn -B -pl IDE -P complete-win-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-jars | |
| path: | | |
| API/target/*complete-win*.jar | |
| IDE/target/*complete-win*.jar | |
| build-macos: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: 2.0.5-final | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Install API to local repo | |
| run: mvn -B -pl API install -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" | |
| - name: Build API fat JAR (macOS) | |
| run: mvn -B -pl API -P complete-mac-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" | |
| - name: Build IDE fat JAR (macOS) | |
| run: mvn -B -pl IDE -P complete-mac-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-jars | |
| path: | | |
| API/target/*complete-mac*.jar | |
| IDE/target/*complete-mac*.jar | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: 2.0.5-final | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Install API to local repo | |
| run: mvn -B -pl API install -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" | |
| - name: Build API fat JAR (Linux) | |
| run: mvn -B -pl API -P complete-lux-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" | |
| - name: Build IDE fat JAR (Linux) | |
| run: mvn -B -pl IDE -P complete-lux-jar package -DskipTests | egrep -v "^\[INFO\].*?Download.*?http" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-jars | |
| path: | | |
| API/target/*complete-lux*.jar | |
| IDE/target/*complete-lux*.jar | |
| release: | |
| needs: [build-windows, build-macos, build-linux] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: 2.0.5-final | |
| - name: Get version from POM | |
| id: version | |
| run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: List downloaded artifacts | |
| run: find . -name "*.jar" -not -path "./.m2/*" | sort | |
| - name: Prepare release assets | |
| run: | | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| mkdir -p release-assets | |
| find windows-jars -name "*complete-win*" -exec cp {} release-assets/ \; | |
| find macos-jars -name "*complete-mac*" -exec cp {} release-assets/ \; | |
| find linux-jars -name "*complete-lux*" -exec cp {} release-assets/ \; | |
| cd release-assets | |
| for f in *-complete-win.jar; do mv "$f" "${f%-complete-win.jar}-windows.jar"; done | |
| for f in *-complete-mac.jar; do mv "$f" "${f%-complete-mac.jar}-macos.jar"; done | |
| for f in *-complete-lux.jar; do mv "$f" "${f%-complete-lux.jar}-linux.jar"; done | |
| echo "=== Release assets ===" | |
| ls -lh | |
| - name: Create release if it does not exist | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| TAG="v${{ steps.version.outputs.VERSION }}" | |
| if ! gh release view "$TAG" > /dev/null 2>&1; then | |
| gh release create "$TAG" \ | |
| --title "SikuliX ${{ steps.version.outputs.VERSION }}" \ | |
| --notes "SikuliX ${{ steps.version.outputs.VERSION }} — built with Java 17, OpenCV 4.5.1. Maintenance transferred to oculix-org." \ | |
| --target master | |
| fi | |
| - name: Upload assets to release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| TAG="v${{ steps.version.outputs.VERSION }}" | |
| gh release upload "$TAG" release-assets/*.jar --clobber |