Skip to content

Commit bc702a2

Browse files
authored
Merge pull request #6499 from gooddata/pb-oneflow-release
feat: add full workflow for minor sdk release
2 parents eba544e + 734a647 commit bc702a2

File tree

5 files changed

+226
-14
lines changed

5 files changed

+226
-14
lines changed

.github/workflows/release-full.yml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
name: Release minor ~ Full workflow
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
gate-approval:
7+
runs-on: ubuntu-latest
8+
environment:
9+
name: production
10+
steps:
11+
- run: echo "Initiating approval"
12+
13+
get-version:
14+
needs: gate-approval
15+
runs-on:
16+
group: infra1-runners-arc
17+
labels: runners-small
18+
outputs:
19+
version: ${{ steps.version.outputs.version }}
20+
branch: ${{ steps.branch.outputs.branch }}
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
with:
25+
ref: 'master'
26+
token: ${{ secrets.TOKEN_GITHUB_YENKINS_ADMIN }}
27+
- name: Setup node
28+
uses: ./.github/actions/node/set-up-node
29+
id: node-init
30+
- name: Get version
31+
uses: gooddata/gooddata-ui-sdk/.github/actions/get-version-action@master
32+
id: version
33+
- name: Get branch
34+
run: |
35+
BRANCH=$(echo $VERSION | sed 's/^\([0-9]*\.[0-9]*\).*/\1/')
36+
REL_BRANCH="rel/$BRANCH"
37+
echo "preparing branch $REL_BRANCH for version $VERSION"
38+
echo "branch=$REL_BRANCH" >> $GITHUB_OUTPUT
39+
env:
40+
VERSION: ${{ steps.version.outputs.version }}
41+
id: branch
42+
43+
# PREPARE REL BRANCH
44+
45+
prepare-branch:
46+
needs: get-version
47+
runs-on: [ubuntu-latest]
48+
permissions:
49+
contents: write
50+
51+
steps:
52+
- name: Run copy branch action
53+
uses: gooddata/gooddata-ui-sdk/.github/actions/branch-cutoff-action@master
54+
with:
55+
source-branch: 'master'
56+
target-branch: ${{ needs.get-version.outputs.branch }}
57+
token: ${{ secrets.TOKEN_GITHUB_YENKINS_ADMIN }}
58+
59+
prepare-versions-release:
60+
needs: [get-version, prepare-branch]
61+
uses: ./.github/workflows/rw-bump-version.yml
62+
secrets: inherit
63+
permissions:
64+
contents: write
65+
with:
66+
source-branch: ${{ needs.get-version.outputs.branch }}
67+
bump: 'prerelease'
68+
prerelease-id: 'beta'
69+
70+
prepare-versions-master:
71+
needs: [get-version, prepare-branch]
72+
uses: ./.github/workflows/rw-bump-version.yml
73+
secrets: inherit
74+
permissions:
75+
contents: write
76+
with:
77+
source-branch: 'master'
78+
bump: 'preminor'
79+
prerelease-id: 'alpha'
80+
81+
# RELEASE
82+
83+
publish-release:
84+
needs: [prepare-versions-release, prepare-versions-master, get-version]
85+
uses: ./.github/workflows/rw-publish-release.yml
86+
permissions:
87+
contents: write
88+
id-token: write
89+
secrets: inherit
90+
with:
91+
bump: 'minor'
92+
source-branch: ${{ needs.get-version.outputs.branch }}
93+
94+
update-hugo-version:
95+
needs: [publish-release, get-version]
96+
uses: ./.github/workflows/rw-doc-update-hugo-version.yml
97+
permissions:
98+
contents: write
99+
secrets: inherit
100+
with:
101+
source-branch: ${{ needs.get-version.outputs.branch }}
102+
version: ${{ needs.publish-release.outputs.version }}
103+
104+
add-release-tag:
105+
needs: [publish-release, update-hugo-version, get-version]
106+
uses: ./.github/workflows/rw-git-create-tag.yml
107+
permissions:
108+
contents: write
109+
with:
110+
source-branch: ${{ needs.get-version.outputs.branch }}
111+
version: ${{ needs.publish-release.outputs.version }}
112+
is-latest: ${{ needs.publish-release.outputs.is-latest}}
113+
114+
port-rel-branch-to-master:
115+
needs: [add-release-tag, update-hugo-version, get-version]
116+
uses: ./.github/workflows/rw-git-push.yml
117+
permissions:
118+
contents: write
119+
pull-requests: write
120+
secrets: inherit
121+
with:
122+
source-branch: ${{ needs.get-version.outputs.branch }}
123+
124+
# DOCS
125+
126+
update-apidocs-version:
127+
needs: [get-version, port-rel-branch-to-master, publish-release]
128+
uses: ./.github/workflows/rw-doc-release-apidocs.yml
129+
permissions:
130+
contents: write
131+
id-token: write
132+
secrets: inherit
133+
with:
134+
source-branch: ${{ needs.get-version.outputs.branch }}
135+
version: ${{ needs.publish-release.outputs.version }}
136+
is-new-latest: true
137+
138+
publish-netlify:
139+
needs: port-rel-branch-to-master
140+
uses: ./.github/workflows/rw-doc-netlify-deploy.yml
141+
permissions:
142+
contents: write
143+
id-token: write
144+
secrets: inherit
145+
146+
slack-notification:
147+
strategy:
148+
matrix:
149+
channels: ["#javascript-notifications", "#releases"]
150+
runs-on: [ubuntu-latest]
151+
needs: [publish-netlify, update-apidocs-version, publish-release]
152+
steps:
153+
- name: Notify to slack
154+
uses: slackapi/slack-github-action@v1.25.0
155+
with:
156+
channel-id: ${{ matrix.channels }}
157+
slack-message: "The release of *gooddata-ui-sdk@${{ needs.publish-version.outputs.version }}*, has been successful. :tada:"
158+
env:
159+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

.github/workflows/rw-doc-release-apidocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
fi
3535
env:
3636
VERSION: ${{ inputs.version }}
37-
3837
- name: Checkout repository
3938
uses: actions/checkout@v4
4039
with:

.github/workflows/rw-git-create-tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Checkout
26-
uses: actions/checkout@v4
26+
uses: actions/checkout@v4
2727
- name: Create Release
2828
id: create_release
2929
uses: ncipollo/release-action@v1.14.0

.github/workflows/rw-git-push.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: rw ~ Git ~ Port and push rel branch to master
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
source-branch:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
perform:
12+
runs-on:
13+
group: infra1-runners-arc
14+
labels: runners-small
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
ref: master2
21+
22+
- name: Git config user
23+
uses: snow-actions/git-config-user@v1.0.0
24+
with:
25+
name: git-action
26+
email: git-action@gooddata.com
27+
28+
- name: Add rel chages to master
29+
uses: nick-fields/retry@v3
30+
env:
31+
TARGET_BRANCH: master2
32+
SOURCE_BRANCH: ${{ inputs.source-branch }}
33+
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB_YENKINS_ADMIN }}
34+
with:
35+
timeout_minutes: 10
36+
max_attempts: 4
37+
retry_on: error
38+
retry_wait_seconds: 2
39+
command: |
40+
set -e
41+
git fetch origin
42+
git reset --hard origin/$TARGET_BRANCH
43+
44+
# cherry-pick hugo changes
45+
PICK_HASH=$(git log -n 1 --pretty=format:"%H" origin/$SOURCE_BRANCH)
46+
echo "Backporting $PICK_HASH (hugo) and changelog from origin/$TARGET_BRANCH to master"
47+
git show $PICK_HASH
48+
git cherry-pick $PICK_HASH
49+
50+
# find out deleted changelog records and delete them and commit
51+
git checkout origin/$SOURCE_BRANCH -- libs/sdk-ui-all/CHANGELOG.json libs/sdk-ui-all/CHANGELOG.md
52+
git add libs/sdk-ui-all/CHANGELOG.json libs/sdk-ui-all/CHANGELOG.md
53+
54+
CHANGELOG_HASH=$(git log -n 2 --pretty=format:"%H" origin/$SOURCE_BRANCH | tail -n 1)
55+
FILES_TO_REMOVE=$(git diff-tree --no-commit-id --name-only -r $CHANGELOG_HASH -- common/changes/@gooddata/sdk-ui-all/)
56+
echo "$FILES_TO_REMOVE" | while read -r file; do
57+
git rm "$file"
58+
done
59+
60+
git commit -m "feat: add changelog changes" -m 'risk: nonprod'
61+
62+
# now rebase all parts and push directly
63+
git fetch origin
64+
git rebase origin/$TARGET_BRANCH
65+
git push origin $TARGET_BRANCH

.github/workflows/rw-publish-documentation.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,8 @@ jobs:
1414
skip-bump: true
1515
source-branch: 'release'
1616

17-
update-apidocs-next:
18-
uses: ./.github/workflows/rw-doc-release-apidocs.yml
19-
permissions:
20-
contents: write
21-
id-token: write
22-
secrets: inherit
23-
with:
24-
source-branch: "master"
25-
version: "Next"
26-
is-new-latest: false
27-
2817
update-apidocs-version:
29-
needs: [get-version, update-apidocs-next]
18+
needs: [get-version]
3019
uses: ./.github/workflows/rw-doc-release-apidocs.yml
3120
permissions:
3221
contents: write

0 commit comments

Comments
 (0)