File tree 1 file changed +23
-9
lines changed
1 file changed +23
-9
lines changed Original file line number Diff line number Diff line change 9
9
get-branches :
10
10
runs-on : ubuntu-latest
11
11
outputs :
12
- branches : ${{ steps.getb.outputs.branches }}
12
+ matrix : ${{ steps.getb.outputs.matrix }}
13
13
steps :
14
+ - name : Checkout
15
+
16
+ with :
17
+ fetch-depth : 0
18
+
14
19
- id : getb
15
20
run : |
16
- branches=[$(git branch -r | grep origin | grep -v '\->' | sed 's/\s*origin\///' | sed 's/^.*$/"&",/')]
17
- echo "branches=$branches" >> $GITHUB_OUTPUT
21
+ declare -A branches=(
22
+ ["dev"]="master"
23
+ ["next"]="aiscript-next"
24
+ )
25
+ matrix='{"include":['
26
+ sep=""
27
+ for tag in "${!branches[@]}"; do
28
+ branch=${branches[${tag}]}
29
+ if git show-ref --quiet refs/remotes/origin/${branch}; then
30
+ matrix="${matrix}${sep}{\"branch\":\"${branch}\",\"tag\":\"${tag}\"}"
31
+ sep=","
32
+ fi
33
+ done
34
+ matrix="${matrix}]}"
35
+ echo "matrix=$matrix" >> $GITHUB_OUTPUT
18
36
19
37
20
38
publish :
21
39
runs-on : ubuntu-latest
40
+ needs : get-branches
22
41
strategy :
23
42
fail-fast : false
24
- matrix :
25
- include :
26
- - branch : master
27
- tag : dev
28
- - branch : aiscript-next
29
- tag : next
43
+ matrix : ${{ fromJSON(needs.get-branches.outputs.matrix) }}
30
44
env :
31
45
NPM_SECRET : ${{ secrets.NPM_SECRET }}
32
46
needs : get-branches
You can’t perform that action at this time.
0 commit comments