Skip to content

Commit aa96cbc

Browse files
authored
Merge pull request #247 from freeswitch/gha_set_source_branch
GHA: Use source branch name in metarepo.
2 parents 97a4aa8 + 6b04ca8 commit aa96cbc

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/all.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build and Distribute
22

33
on:
4+
pull_request:
45
push:
56
branches: [ master ]
67
paths:
@@ -44,6 +45,7 @@ jobs:
4445
PLATFORM: ${{ matrix.platform }}
4546

4647
generate_meta_rpm:
48+
if: (github.ref_type == 'branch' && github.base_ref == '')
4749
name: 'Meta RPM'
4850
needs: [ build_rpm ]
4951
strategy:
@@ -57,9 +59,10 @@ jobs:
5759
ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-artifact
5860
OS_PLATFORM: ${{ matrix.os }}-${{ matrix.platform }}
5961
RUNNER: ubuntu-latest
60-
FILE_PATH_PREFIX: /var/www/sofia-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}
62+
FILE_PATH_PREFIX: /var/www/sofia-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}
6163

6264
generate_meta_deb:
65+
if: (github.ref_type == 'branch' && github.base_ref == '')
6366
name: 'Meta DEB'
6467
needs: [ build_deb ]
6568
strategy:
@@ -79,9 +82,10 @@ jobs:
7982
ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-artifact
8083
OS_PLATFORM: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}
8184
RUNNER: ubuntu-latest
82-
FILE_PATH_PREFIX: /var/www/sofia-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}
85+
FILE_PATH_PREFIX: /var/www/sofia-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}
8386

8487
distribute_matrix_rpm:
88+
if: (github.ref_type == 'branch' && github.base_ref == '')
8589
permissions: write-all
8690
name: 'Copy to remote RPM'
8791
needs: [ build_rpm ]
@@ -94,7 +98,7 @@ jobs:
9498
uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main
9599
with:
96100
ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-artifact
97-
TARGET_FOLDER: /var/www/sofia-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}
101+
TARGET_FOLDER: /var/www/sofia-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}
98102
RUNNER: ubuntu-latest
99103
FILES: '*.tar.gz'
100104
CREATE_DESTINATION_FOLDERS: true
@@ -106,6 +110,7 @@ jobs:
106110
TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }}
107111

108112
distribute_matrix_deb:
113+
if: (github.ref_type == 'branch' && github.base_ref == '')
109114
permissions: write-all
110115
name: 'Copy to remote DEB'
111116
needs: [ build_deb ]
@@ -124,7 +129,7 @@ jobs:
124129
uses: signalwire/actions-template/.github/workflows/cd-scp.yml@main
125130
with:
126131
ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-artifact
127-
TARGET_FOLDER: /var/www/sofia-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}
132+
TARGET_FOLDER: /var/www/sofia-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}
128133
RUNNER: ubuntu-latest
129134
FILES: '*.tar.gz'
130135
CREATE_DESTINATION_FOLDERS: true
@@ -136,6 +141,7 @@ jobs:
136141
TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }}
137142

138143
distribute_meta_rpm:
144+
if: (github.ref_type == 'branch' && github.base_ref == '')
139145
permissions: write-all
140146
name: 'Copy meta to remote RPM'
141147
needs: [ generate_meta_rpm ]
@@ -150,6 +156,7 @@ jobs:
150156
with:
151157
ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.platform }}-meta
152158
LIB_NAME: sofia-sip
159+
SOURCE_BRANCH: ${{ github.ref_name }}
153160
TARGET_OS: ${{ matrix.os }}
154161
TARGET_PLATFORM: ${{ matrix.platform }}
155162
RUNNER: ubuntu-latest
@@ -161,6 +168,7 @@ jobs:
161168
cancel-in-progress: false
162169

163170
distribute_meta_deb:
171+
if: (github.ref_type == 'branch' && github.base_ref == '')
164172
permissions: write-all
165173
name: 'Copy meta to remote DEB'
166174
needs: [ generate_meta_deb ]
@@ -181,6 +189,7 @@ jobs:
181189
with:
182190
ARTIFACT_NAME: ${{ matrix.os }}-${{ matrix.codename }}-${{ matrix.platform }}-meta
183191
LIB_NAME: sofia-sip
192+
SOURCE_BRANCH: ${{ github.ref_name }}
184193
TARGET_OS: ${{ matrix.os }}
185194
TARGET_PLATFORM: ${{ matrix.platform }}
186195
RUNNER: ubuntu-latest
@@ -192,6 +201,7 @@ jobs:
192201
cancel-in-progress: true
193202

194203
distribute_hash_rpm:
204+
if: (github.ref_type == 'branch' && github.base_ref == '')
195205
permissions: write-all
196206
name: 'Copy hash to remote RPM'
197207
needs: [ distribute_meta_rpm ]
@@ -205,14 +215,15 @@ jobs:
205215
with:
206216
RUNNER: ubuntu-latest
207217
CREATE_DESTINATION_FOLDERS: false
208-
EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/sofia-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}/hash.txt'
218+
EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/sofia-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}/hash.txt'
209219
secrets:
210220
PROXY_URL: ${{ secrets.PROXY_URL }}
211221
USERNAME: ${{ secrets.USERNAME }}
212222
HOSTNAME: ${{ secrets.HOSTNAME }}
213223
TELEPORT_TOKEN: ${{ secrets.TELEPORT_TOKEN }}
214224

215225
distribute_hash_deb:
226+
if: (github.ref_type == 'branch' && github.base_ref == '')
216227
permissions: write-all
217228
name: 'Copy hash to remote DEB'
218229
needs: [ distribute_meta_deb ]
@@ -227,7 +238,7 @@ jobs:
227238
with:
228239
RUNNER: ubuntu-latest
229240
CREATE_DESTINATION_FOLDERS: false
230-
EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/sofia-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}/hash.txt'
241+
EXEC_COMMANDS: 'echo "${{ github.sha }}" > /var/www/sofia-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.platform }}/${{ github.run_id }}-${{ github.run_number }}/hash.txt'
231242
secrets:
232243
PROXY_URL: ${{ secrets.PROXY_URL }}
233244
USERNAME: ${{ secrets.USERNAME }}

0 commit comments

Comments
 (0)