forked from harvester/eventrouter
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (63 loc) · 2.21 KB
/
Copy pathnightly.yml
File metadata and controls
68 lines (63 loc) · 2.21 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
name: nightly
on:
workflow_dispatch:
inputs:
ref:
description: 'Branch or tag to build (leave empty for the full nightly run: master + v1.7+ release branches)'
required: false
default: ''
tag:
description: 'Image tag override (defaults to <ref>-head; only used when ref is set)'
required: false
default: ''
schedule:
# run at 03:30 UTC every night
- cron: '30 3 * * *'
jobs:
# Manual single-ref build (only when ref input is provided)
build-for-ref:
if: ${{ github.event_name == 'workflow_dispatch' && inputs.ref != '' }}
uses: ./.github/workflows/factory.yml
with:
refs: ${{ inputs.ref }}
tag: ${{ inputs.tag != '' && inputs.tag || format('{0}-head', inputs.ref) }}
push: true
secrets: inherit
# Full nightly run: schedule, or workflow_dispatch without a specific ref
discover-branches:
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.ref == '') }}
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.list.outputs.branches }}
steps:
- name: List release branches to build (v1.7+)
id: list
env:
GH_TOKEN: ${{ github.token }}
run: |
branches=$(gh api "repos/${{ github.repository }}/branches" --paginate --jq '.[].name' \
| awk -F. '/^v1\.[0-9]+$/ && $2+0 >= 7 {print}' \
| jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "branches=$branches" >> "$GITHUB_OUTPUT"
echo "Discovered: $branches"
build-for-master:
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.ref == '') }}
uses: ./.github/workflows/factory.yml
with:
refs: master
tag: master-head
push: true
secrets: inherit
build-for-release-branches:
needs: discover-branches
if: ${{ needs.discover-branches.outputs.branches != '[]' }}
strategy:
fail-fast: false
matrix:
branch: ${{ fromJson(needs.discover-branches.outputs.branches) }}
uses: ./.github/workflows/factory.yml
with:
refs: ${{ matrix.branch }}
tag: ${{ matrix.branch }}-head
push: true
secrets: inherit