1+ name : Build
2+
3+ on :
4+ push :
5+ branches :
6+ - ' main'
7+ tags :
8+ - ' v*'
9+ pull_request :
10+
11+ env :
12+ # needed to access our GitHub Maven repository
13+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
14+ MAVEN_OPTS : " -Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=false -Djava.awt.headless=true"
15+
16+ jobs :
17+ dependency-resolution :
18+ runs-on : ubuntu-latest
19+
20+ steps :
21+ - uses : actions/checkout@v4
22+ with :
23+ submodules : recursive
24+ fetch-depth : 0
25+
26+ - name : Cache local Maven repository
27+ id : cache
28+ uses : actions/cache@v3
29+ with :
30+ path : ~/.m2/repository
31+ key : maven-${{ hashFiles('**/pom.xml') }}
32+ restore-keys : |
33+ maven-
34+
35+ - name : asdf_install
36+ uses : asdf-vm/actions/install@v3
37+ if : steps.cache.outputs.cache-hit != 'true'
38+
39+ - name : download dependencies
40+ id : download-dependencies
41+ run : |
42+ export JAVA_HOME=$(asdf where java)
43+ ./mvnw -B de.qaware.maven:go-offline-maven-plugin:1.2.8:resolve-dependencies
44+ if : steps.cache.outputs.cache-hit != 'true'
45+
46+ deploy_maven :
47+ permissions : write-all
48+ needs : dependency-resolution
49+ runs-on : ubuntu-latest
50+ if : github.ref_type == 'tag' || github.ref_name == 'main'
51+
52+ steps :
53+ - name : Strip version prefix
54+ id : strip-version-prefix
55+ uses : ashley-taylor/regex-property-action@v1
56+ if : github.ref_type == 'tag'
57+ with :
58+ value : " ${{ github.ref_name }}"
59+ regex : " v?(.*)"
60+ replacement : " $1"
61+
62+ - name : Replace dots
63+ id : replace-dots
64+ uses : ashley-taylor/regex-property-action@v1
65+ if : github.ref_type == 'tag'
66+ with :
67+ value : " ${{ steps.strip-version-prefix.outputs.value }}"
68+ regex : " \\ ."
69+ replacement : " \\ ."
70+
71+ - name : Delete tagged packages
72+ uses : advanova/delete-old-packages@main
73+ if : github.ref_type == 'tag'
74+ with :
75+ organization : advanova
76+ type : maven
77+ rate-limit : true
78+ keep : 0
79+ version-pattern : " ^${{ steps.replace-dots.outputs.value }}$"
80+ name-pattern : " org\\ .talend\\ .studio.*"
81+
82+ - uses : actions/checkout@v4
83+ with :
84+ submodules : recursive
85+ fetch-depth : 0
86+
87+ - name : Retrieve cached local Maven repository
88+ id : cache
89+ uses : actions/cache/restore@v3
90+ with :
91+ path : ~/.m2/repository
92+ key : maven-${{ hashFiles('**/pom.xml') }}
93+ restore-keys : |
94+ maven-
95+
96+ - name : asdf_install
97+ uses : asdf-vm/actions/install@v3
98+
99+ - name : build talend open studio
100+ run : |
101+ export JAVA_HOME=$(asdf where java)
102+ ./mvnw -B clean deploy -DskipTests -Dversioning.disable=false -Dtos.products=false -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }}
103+
104+ build :
105+ strategy :
106+ fail-fast : false
107+ matrix :
108+ product : ['tos.bd','tos.di','tos.dq','tos.esb']
109+ runs-on : ubuntu-latest
110+ needs : dependency-resolution
111+
112+ steps :
113+ - uses : actions/checkout@v4
114+ with :
115+ submodules : recursive
116+ fetch-depth : 0
117+
118+ - name : Retrieve cached local Maven repository
119+ id : cache
120+ uses : actions/cache/restore@v3
121+ with :
122+ path : ~/.m2/repository
123+ key : maven-${{ hashFiles('**/pom.xml') }}
124+ restore-keys : |
125+ maven-
126+
127+ - name : asdf_install
128+ uses : asdf-vm/actions/install@v3
129+
130+ - name : build talend open studio
131+ run : |
132+ export JAVA_HOME=$(asdf where java)
133+ ./mvnw -B clean install -P-nonofficial -DskipTests -D${{ matrix.product }}=true
134+
135+ - name : Archive build artifacts
136+ uses : actions/upload-artifact@v3
137+ with :
138+ name : ${{ matrix.product }}
139+ path : ' build/storage/**'
140+
141+ release :
142+ runs-on : ubuntu-latest
143+ needs : build
144+ if : github.ref_type == 'tag' || github.ref_name == 'main'
145+
146+ steps :
147+ - uses : actions/checkout@v4
148+
149+ - name : Download artifact
150+ uses : actions/download-artifact@v3
151+
152+ - name : Display structure of downloaded files
153+ run : ls -R
154+
155+ - name : tag main branch as latest
156+ if : github.ref_name == 'main'
157+ run : git tag -f latest
158+
159+ - name : push latest tag
160+ if : github.ref_name == 'main'
161+ run : git push -f origin latest
162+
163+ - name : Delete old release
164+ # Can be replaced with https://github.com/softprops/action-gh-release/pull/188 if that is implemented
165+ uses : liudonghua123/delete-release-action@v1
166+ with :
167+ release_name : ' latest'
168+ suppress_errors : true
169+
170+ - name : Release
171+ if : github.ref_name == 'main' || github.ref_type == 'tag'
172+ uses : softprops/action-gh-release@v1
173+ with :
174+ files : |
175+ **/*.zip
176+ prerelease : ${{ github.ref_type != 'tag' }}
177+ generate_release_notes : true
178+ tag_name : ${{ github.ref_type == 'tag' && github.ref_name || 'latest' }}
0 commit comments