-
Notifications
You must be signed in to change notification settings - Fork 151
74 lines (67 loc) · 2.52 KB
/
sync-versions.yml
File metadata and controls
74 lines (67 loc) · 2.52 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
69
70
71
72
73
74
# Sync Calico and Calico Enterprise versions and CRDs into this repo.
# Creates or updates a PR if anything changed.
---
name: Sync versions
on:
schedule:
- cron: '0 * * * *' # every hour
workflow_dispatch: {}
permissions:
contents: write
pull-requests: write
jobs:
discover-branches:
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.branches.outputs.branches }}
steps:
- name: Discover branches
id: branches
run: |
# Get master + the two most recent release branches (by semver).
branches=$(gh api repos/${{ github.repository }}/branches --paginate --jq '
[.[] | select(.name | test("^release-v[0-9]+\\.[0-9]+$")) | .name]
| sort_by(ltrimstr("release-v") | split(".") | map(tonumber))
| .[-2:]
| ["master"] + .
')
echo "branches=${branches}" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
sync:
needs: discover-branches
runs-on: ubuntu-latest
concurrency:
group: sync-versions-${{ matrix.branch }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
branch: ${{ fromJson(needs.discover-branches.outputs.branches) }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ matrix.branch }}
persist-credentials: false
- name: Configure git auth
run: |
git config --global credential.helper store
echo "https://marvin-tigera:${GITHUB_TOKEN}@github.com" > ~/.git-credentials
git config --global url."https://github.com/".insteadOf "git@github.com:"
env:
GITHUB_TOKEN: ${{ secrets.MARVIN_PAT }}
- name: Gen versions
run: make gen-versions GIT_CLONE_URL_BASE=https://github.com/
- uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Sync versions from Calico and Calico Enterprise"
branch: auto-sync-versions-${{ matrix.branch }}
base: ${{ matrix.branch }}
title: "Auto: sync versions [${{ matrix.branch }}]"
body: |
Automated sync of versions and CRDs from Calico and Calico Enterprise into
`${{ matrix.branch }}` via `make gen-versions`.
Triggered by scheduled workflow.
labels: auto-sync,docs-not-required,release-note-not-required,merge-when-ready
delete-branch: true