Skip to content

Commit aaa94e2

Browse files
build(ci): publish artifacts to Terasology artifactory (#20)
* build(ci): combine workflows into a single one * build(ci): upgrade action dependencies * build: update Terasology artifactory URL --------- Co-authored-by: jdrueckert <jd.rueckert@googlemail.com>
1 parent 85b1a57 commit aaa94e2

File tree

5 files changed

+132
-112
lines changed

5 files changed

+132
-112
lines changed

.github/workflows/allInOne.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Build and Publish for all Platforms
2+
3+
on: [push]
4+
5+
jobs:
6+
validate-gradle-wrapper:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Validate Gradle Wrapper
11+
uses: gradle/wrapper-validation-action@v2
12+
build-linux-windows-amd64:
13+
runs-on: ubuntu-latest
14+
needs: validate-gradle-wrapper
15+
steps:
16+
- name: Install SWIG
17+
run: sudo apt-get install swig mingw-w64
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
- name: Set up JDK
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '11'
25+
distribution: 'adopt'
26+
- name: Setup Gradle
27+
uses: gradle/actions/setup-gradle@v3
28+
- name: Build
29+
run: ./gradlew buildNatives
30+
- name: Upload artifacts
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: linux-windows-amd64-artifacts
34+
path: |
35+
build/natives/*/*.so
36+
build/natives/*/*.dll
37+
build/natives/*/*.dylib
38+
build-macos-amd64:
39+
runs-on: macos-12
40+
needs: validate-gradle-wrapper
41+
steps:
42+
- name: Install SWIG and CMake
43+
run: |
44+
brew install swig
45+
brew install cmake
46+
- uses: actions/checkout@v4
47+
with:
48+
submodules: true
49+
- name: Set up JDK
50+
uses: actions/setup-java@v4
51+
with:
52+
java-version: '11'
53+
distribution: 'adopt'
54+
- name: Setup Gradle
55+
uses: gradle/actions/setup-gradle@v3
56+
- name: Build
57+
run: ./gradlew native_macosx_amd64_clang
58+
- name: Upload artifacts
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: macosx-amd64-artifacts
62+
path: |
63+
build/natives/*/*.so
64+
build/natives/*/*.dll
65+
build/natives/*/*.dylib
66+
build-macos-aarch64:
67+
runs-on: macos-14
68+
needs: validate-gradle-wrapper
69+
steps:
70+
- name: Install SWIG and CMake
71+
run: |
72+
brew install swig
73+
brew install cmake
74+
- uses: actions/checkout@v4
75+
with:
76+
submodules: true
77+
- name: Set up JDK
78+
uses: actions/setup-java@v4
79+
with:
80+
java-version: '11'
81+
distribution: 'adopt'
82+
- name: Setup Gradle
83+
uses: gradle/actions/setup-gradle@v3
84+
- name: Build
85+
run: ./gradlew native_macosx_aarch64_clang
86+
- name: Upload artifacts
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: macosx-aarch64-artifacts
90+
path: |
91+
build/natives/*/*.so
92+
build/natives/*/*.dll
93+
build/natives/*/*.dylib
94+
publish:
95+
runs-on: ubuntu-latest
96+
needs: [validate-gradle-wrapper,build-linux-windows-amd64, build-macos-amd64, build-macos-aarch64]
97+
if: github.ref == 'refs/heads/master'
98+
steps:
99+
- name: Install SWIG
100+
run: sudo apt-get install swig mingw-w64
101+
- name: Set up JDK
102+
uses: actions/setup-java@v4
103+
with:
104+
java-version: '11'
105+
distribution: 'adopt'
106+
- uses: actions/checkout@v4
107+
with:
108+
submodules: true
109+
- name: Setup Gradle
110+
uses: gradle/actions/setup-gradle@v3
111+
- name: Download all artifacts
112+
uses: actions/download-artifact@v4
113+
with:
114+
path: build/natives
115+
merge-multiple: true
116+
- name: Build and Zip Natives
117+
run: ./gradlew build zipNatives
118+
- run: |
119+
ls -R build/natives/
120+
ls -R build/libs/
121+
- name: Publish
122+
run: ./gradlew -Dorg.gradle.internal.publish.checksums.insecure=true publish -PmavenUser=${artifactoryUser} -PmavenPass=${artifactoryPass}
123+
env:
124+
artifactoryUser: ${{ secrets.ARTIFACTORY_USER }}
125+
artifactoryPass: ${{ secrets.ARTIFACTORY_PASS }}

.github/workflows/linux_amd64.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/macosx_aarch64.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/macosx_amd64.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ repositories {
4545
} else {
4646
// Our default is the main virtual repo containing everything except repos for testing Artifactory itself
4747
name "Terasology Artifactory"
48-
url "http://artifactory.terasology.org/artifactory/virtual-repo-live"
49-
allowInsecureProtocol true // 😱
48+
url "https://artifactory.terasology.io/artifactory/virtual-repo-live"
5049
}
5150
}
5251
}
@@ -157,7 +156,9 @@ task zipNatives(type: Zip){
157156
}
158157

159158
buildNatives.dependsOn generateSources
160-
zipNatives.dependsOn buildNatives
159+
// Building natives is a prerequisite for zipping them, but we don't want to re-compute them every time.
160+
// Also, we build natives on different platforms and combine them to a single zip, so we can't just depend on the native tasks anyway.
161+
//zipNatives.dependsOn buildNatives
161162

162163
javadoc {
163164
failOnError = false
@@ -207,12 +208,11 @@ publishing {
207208

208209
repositories {
209210
maven {
210-
name = 'TerasologyOrg'
211-
allowInsecureProtocol true // 😱 - no https on our Artifactory yet
211+
name = 'TerasologyOrg'
212212

213213
if (rootProject.hasProperty("publishRepo")) {
214214
// This first option is good for local testing, you can set a full explicit target repo in gradle.properties
215-
url = "http://artifactory.terasology.org/artifactory/$publishRepo"
215+
url = "https://artifactory.terasology.io/artifactory/$publishRepo"
216216

217217
logger.info("Changing PUBLISH repoKey set via Gradle property to {}", publishRepo)
218218
} else {
@@ -231,7 +231,7 @@ publishing {
231231
}
232232

233233
logger.info("The final deduced publish repo is {}", deducedPublishRepo)
234-
url = "http://artifactory.terasology.org/artifactory/$deducedPublishRepo"
234+
url = "https://artifactory.terasology.io/artifactory/$deducedPublishRepo"
235235
}
236236

237237
if (rootProject.hasProperty("mavenUser") && rootProject.hasProperty("mavenPass")) {

0 commit comments

Comments
 (0)