forked from openstack-snaps/ubuntu-openstack-rocks
-
Notifications
You must be signed in to change notification settings - Fork 9
55 lines (52 loc) · 1.66 KB
/
publish_branch.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Publish all ROCKs from selected branch
on:
workflow_dispatch:
inputs:
branch:
description: Branch to publish
required: true
default: main
type: choice
options:
- main
- stable/2023.1
filter:
description: Build/publish only matching ROCKs
required: false
default: ''
type: string
jobs:
allrocks:
runs-on: ubuntu-latest
outputs:
rocks: ${{ steps.all-rocks.outputs.rocks }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: List rockcraft files
id: list-files
run: |
all_rock_files=$(find rocks -name rockcraft.yaml -printf "%p ")
echo "All rock files: $all_rock_files"
echo "all_rock_files=$all_rock_files" >> $GITHUB_OUTPUT
- name: set output
id: all-rocks
run: |
components=()
# trim file name to component name
for file in ${{ steps.list-files.outputs.all_rock_files }}; do
component=$(echo $file | sed 's/rocks\/\(\S.*\)\/rockcraft.yaml/\1/')
[[ ! -z "$component" ]] && components+=($component)
done
all_rocks=$(echo "\"${components[@]}\"" | jq --compact-output '[. | split(" ") | .[] | select(. | match("${{ inputs.filter }}"))]')
echo "All rocks: $all_rocks"
echo "rocks=$all_rocks" >> $GITHUB_OUTPUT
build-and-publish:
needs: allrocks
uses: ./.github/workflows/build_publish.yaml
with:
rocks: ${{ needs.allrocks.outputs.rocks }}
branch: ${{ inputs.branch }}
publish: true