build(ci): publish artifacts to Terasology artifactory (#20) #1
This file contains 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 Publish for all Platforms | |
on: [push] | |
jobs: | |
validate-gradle-wrapper: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v2 | |
build-linux-windows-amd64: | |
runs-on: ubuntu-latest | |
needs: validate-gradle-wrapper | |
steps: | |
- name: Install SWIG | |
run: sudo apt-get install swig mingw-w64 | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build | |
run: ./gradlew buildNatives | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-windows-amd64-artifacts | |
path: | | |
build/natives/*/*.so | |
build/natives/*/*.dll | |
build/natives/*/*.dylib | |
build-macos-amd64: | |
runs-on: macos-12 | |
needs: validate-gradle-wrapper | |
steps: | |
- name: Install SWIG and CMake | |
run: | | |
brew install swig | |
brew install cmake | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build | |
run: ./gradlew native_macosx_amd64_clang | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macosx-amd64-artifacts | |
path: | | |
build/natives/*/*.so | |
build/natives/*/*.dll | |
build/natives/*/*.dylib | |
build-macos-aarch64: | |
runs-on: macos-14 | |
needs: validate-gradle-wrapper | |
steps: | |
- name: Install SWIG and CMake | |
run: | | |
brew install swig | |
brew install cmake | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build | |
run: ./gradlew native_macosx_aarch64_clang | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macosx-aarch64-artifacts | |
path: | | |
build/natives/*/*.so | |
build/natives/*/*.dll | |
build/natives/*/*.dylib | |
publish: | |
runs-on: ubuntu-latest | |
needs: [validate-gradle-wrapper,build-linux-windows-amd64, build-macos-amd64, build-macos-aarch64] | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Install SWIG | |
run: sudo apt-get install swig mingw-w64 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: build/natives | |
merge-multiple: true | |
- name: Build and Zip Natives | |
run: ./gradlew build zipNatives | |
- run: | | |
ls -R build/natives/ | |
ls -R build/libs/ | |
- name: Publish | |
run: ./gradlew -Dorg.gradle.internal.publish.checksums.insecure=true publish -PmavenUser=${artifactoryUser} -PmavenPass=${artifactoryPass} | |
env: | |
artifactoryUser: ${{ secrets.ARTIFACTORY_USER }} | |
artifactoryPass: ${{ secrets.ARTIFACTORY_PASS }} |