-
Notifications
You must be signed in to change notification settings - Fork 60
135 lines (112 loc) · 4.44 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Create release
on:
workflow_dispatch:
inputs:
dl_back_version:
type: string
description: "datalens-backend version"
dl_ui_version:
type: string
description: "datalens-ui version"
dl_us_version:
type: string
description: "datalens-us version"
release_type:
type: choice
description: "Release type"
options:
- "major"
- "minor"
- "patch"
default: "minor"
permissions:
contents: write
pull-requests: write
jobs:
run:
name: "Create release"
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.create_branch.outputs.branch }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "${{ github.event.inputs.branch }}"
fetch-depth: 0
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install python dependencies
working-directory: .github/workflows/scripts/changelog
run: pip install -r requirements.txt
- name: Render versions input
id: render_versions_input
run: |
dl_back_version=${{ github.event.inputs.dl_back_version }}
dl_ui_version=${{ github.event.inputs.dl_ui_version }}
dl_us_version=${{ github.event.inputs.dl_us_version }}
result=""
if [[ -n "${dl_back_version}" ]]; then
result="datalens-backend:${dl_back_version}"
fi
if [[ -n "${dl_ui_version}" ]]; then
result="$result datalens-ui:${dl_ui_version}"
fi
if [[ -n "${dl_us_version}" ]]; then
result="$result datalens-us:${dl_us_version}"
fi
echo "versions_input=${result}" | tee -a $GITHUB_OUTPUT
- name: Setup user
run: |
git config user.email "" && git config user.name "GitHub Release"
- name: Clone repos
working-directory: .github/workflows/scripts/changelog
run: |
CONFIG_FILE="./changelog_config.json" bash clone_repos.sh
- name: Run changelog gatherer
id: gather_changelog
working-directory: .github/workflows/scripts/changelog
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
python releaser.py \
--config-path="./changelog_config.json" \
--repos-dir="./repos" \
--release-type="${{ github.event.inputs.release_type }}" \
--changelog-path="../../../../CHANGELOG.md" \
--version-config-path "../../../../versions-config.json" \
--root-repo-name=${{ github.repository_owner }}/${{ github.event.repository.name }} \
--new-repo-versions "${{ steps.render_versions_input.outputs.versions_input }}" \
--make-outputs \
--create-release
cat outputs.txt | tee -a "$GITHUB_OUTPUT"
- name: Create branch
id: create_branch
run: |
branch="release/${{ steps.gather_changelog.outputs.release_version }}"
git checkout -B $branch origin/main
git push --set-upstream origin $branch
echo "branch=${branch}" >> $GITHUB_OUTPUT
- name: Commit and push branch
run: |
git add CHANGELOG.md versions-config.json
git commit --message "DataLens release v${{ steps.gather_changelog.outputs.release_version }}"
git push origin ${{ steps.create_branch.outputs.branch }}
- name: Create PR
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
pr_body="
This PR is created by a GitHub action.
Navigate to the [release page](${{ steps.gather_changelog.outputs.release_url }}) to validate the release description.
If the description needs changing, do not edit the description manually, instead edit the \`CHANGELOG.md\` file in this PR and the release will be updated automatically.
When you are ready to confirm this release, merge this PR and publish the release (in that order, to keep release tags consistent)."
pr_link=$(gh pr create \
--title "Release DataLens v${{ steps.gather_changelog.outputs.release_version }}" \
--body "$pr_body" \
--base main \
--head ${{ steps.create_branch.outputs.branch }} \
--draft)
echo "::notice title=Created PR::$pr_link"