forked from Mellanox/network-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (71 loc) · 3.17 KB
/
release.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
on:
issues:
types:
- opened
jobs:
update_network_operator_version:
if: ${{ startsWith(github.event.issue.title, 'Release v') }}
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }}
ISSUE_TITLE: ${{ github.event.issue.title }}
steps:
- uses: actions/checkout@v4
- run: |
echo "RELEASE_VERSION=$(echo $ISSUE_TITLE | awk '{ print $2 }')" >> $GITHUB_ENV
echo "CHART_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV
- name: Determine base branch
run: |
if echo $RELEASE_VERSION | grep -q beta; then
base_branch=master
else
v_major_minor=$(echo $RELEASE_VERSION | grep -Eo '^v[0-9]+\.[0-9]+')
base_branch=$v_major_minor.x
fi
echo BASE_BRANCH=$base_branch | tee -a $GITHUB_ENV
- run: |
git config user.name nvidia-ci-cd
git config user.email svc-cloud-orch-gh@nvidia.com
git checkout -b cidi/update-network-operator-to-$RELEASE_VERSION
yq -i e '.NetworkOperator.version = "${{ env.RELEASE_VERSION }}"' hack/release.yaml
yq -i e '.version = "$CHART_VERSION"' deployment/network-operator/Chart.yaml
yq -i e '.appVersion = "${{ env.RELEASE_VERSION }}"' deployment/network-operator/Chart.yaml
make release-build
if ! git diff --color --unified=0 --exit-code; then
git add deployment/network-operator/
git add hack/release.yaml
git commit -sam "cicd: update Network Operator to $RELEASE_VERSION in chart values"
git push -u origin cidi/update-network-operator-to-$RELEASE_VERSION
gh pr create \
--repo ${{ github.repository_owner }}/network-operator \
--base $BASE_BRANCH \
--head $(git branch --show-current) \
--title "cicd: update Network Operator to $RELEASE_VERSION in chart values" \
--body "Created by the *${{ github.job }}* job."
fi
update_sriov_operator_version:
if: ${{ startsWith(github.event.issue.title, 'Release v') }}
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }}
ISSUE_TITLE: ${{ github.event.issue.title }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }}
repository: ${{ github.repository_owner }}/sriov-network-operator
path: sriov-network-operator-fork
- run: |
echo "RELEASE_VERSION=$(echo $ISSUE_TITLE | awk -F 'Release v' '{ print $2 }')" >> $GITHUB_ENV
- name: Determine sriov-network-operator branch
run: |
major_minor=$(echo $RELEASE_VERSION | grep -Eo '[0-9]+\.[0-9]+')
echo BASE_BRANCH=network-operator-$major_minor.x | tee -a $GITHUB_ENV
- name: Create tag to trigger PR that update image tags in network-operator values
run: |
cd sriov-network-operator-fork
git config user.name nvidia-ci-cd
git config user.email svc-cloud-orch-gh@nvidia.com
git checkout -b $RELEASE_VERSION origin/$BASE_BRANCH
git tag $RELEASE_VERSION
git push origin --tags