forked from open-cluster-management-io/ocm
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (82 loc) · 2.79 KB
/
release.yml
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
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/ocm
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/ocm
- name: get release version
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: get major release version
run: |
echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV
echo "TRIMMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV
outputs:
MAJOR_RELEASE_VERSION: ${{ env.MAJOR_RELEASE_VERSION }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
TRIMMED_RELEASE_VERSION: ${{ env.TRIMMED_RELEASE_VERSION }}
release:
name: release
runs-on: ubuntu-latest
needs: [ env ]
permissions:
contents: write
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: go/src/open-cluster-management.io/ocm
- 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 }} ${{ 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: |
mkdir -p release
pushd release
helm package ../deploy/cluster-manager/chart/cluster-manager --app-version ${{ needs.env.outputs.RELEASE_VERSION }} --version ${{ needs.env.outputs.TRIMMED_RELEASE_VERSION }}
helm package ../deploy/klusterlet/chart/klusterlet --app-version ${{ needs.env.outputs.RELEASE_VERSION }} --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/ocm/ocm/go/src/open-cluster-management.io/ocm/release/*.tgz