forked from open-cluster-management-io/addon-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (97 loc) · 3.42 KB
/
Copy pathrelease.yml
File metadata and controls
110 lines (97 loc) · 3.42 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: GoRelease
permissions:
contents: read
on:
pull_request:
paths:
- .github/workflows/release.yml
push:
tags:
- '*/v*.*.*'
env:
GITHUB_REF: ${{ github.ref }}
defaults:
run:
working-directory: go/src/open-cluster-management.io/addon-contrib
jobs:
env:
name: prepare release env
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: go/src/open-cluster-management.io/addon-contrib
- name: prepare release environment
id: prepare-env
uses: ./go/src/open-cluster-management.io/addon-contrib/.github/actions/prepare-release-env
with:
github_ref: ${{ github.ref }}
outputs:
MAJOR_RELEASE_VERSION: ${{ steps.prepare-env.outputs.MAJOR_RELEASE_VERSION }}
RELEASE_VERSION: ${{ steps.prepare-env.outputs.RELEASE_VERSION }}
TRIMMED_RELEASE_VERSION: ${{ steps.prepare-env.outputs.TRIMMED_RELEASE_VERSION }}
MATRIX: ${{ steps.prepare-env.outputs.MATRIX }}
release:
name: release
runs-on: ubuntu-latest
needs: [ env ]
permissions:
contents: write
strategy:
matrix: ${{ fromJson(needs.env.outputs.MATRIX) }}
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: go/src/open-cluster-management.io/addon-contrib
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyGithub
- name: generate changelog
run: |
python hack/changelog.py ${{ secrets.GITHUB_TOKEN }} ${{ matrix.repository }} ${{ needs.env.outputs.RELEASE_VERSION }} > /home/runner/work/changelog.txt
cat /home/runner/work/changelog.txt
- name: setup helm
uses: azure/setup-helm@v4
- name: chart package
if: github.event_name != 'pull_request'
run: |
set -e
mkdir -p release
pushd release
yq eval '.dependencies[] | .name + " " + .repository' ../${{ matrix.repository }}/charts/${{ matrix.repository }}/Chart.yaml | while read -r repo_name repo_url; do
if [[ ! "$repo_url" =~ ^(oci://|file://) ]]; then
helm repo add "$repo_name" "$repo_url"
else
echo "Skipping repository $repo_url for $repo_name"
fi
done
if helm repo list | grep -q .; then
helm repo update
else
echo "No helm repositories to update."
fi
helm dependency build ../${{ matrix.repository }}/charts/${{ matrix.repository }}
helm package ../${{ matrix.repository }}/charts/${{ matrix.repository }} \
--version ${{ needs.env.outputs.TRIMMED_RELEASE_VERSION }}
popd
- name: publish release
if: github.event_name != 'pull_request'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: /home/runner/work/changelog.txt
draft: true
generate_release_notes: true
files: |
/home/runner/work/addon-contrib/addon-contrib/go/src/open-cluster-management.io/addon-contrib/release/*.tgz