Skip to content

Commit 95def19

Browse files
authored
add workflow to manually fix a release (#1065)
1 parent 6b59d1b commit 95def19

1 file changed

Lines changed: 130 additions & 0 deletions

File tree

.github/workflows/release-fix.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
version:
5+
description: 'SDK version'
6+
required: true
7+
8+
name: ReleaseFix
9+
10+
# Declare default permissions as read only.
11+
permissions: read-all
12+
13+
jobs:
14+
update_readme:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
# Get GitHub token via the CT SDKs App
19+
- name: Generate GitHub token (via CT SDKs App)
20+
id: generate_github_token
21+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2
22+
with:
23+
app-id: ${{ secrets.CT_SDKS_APP_ID }}
24+
private-key: ${{ secrets.CT_SDKS_APP_PEM }}
25+
26+
- name: Get App user
27+
id: get_app_user
28+
env:
29+
GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }}
30+
run: |
31+
export GH_APP_USER=`gh api /users/ct-sdks%5Bbot%5D | jq .id`
32+
echo "email=${GH_APP_USER}+ct-sdks[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
33+
34+
- name: Checkout
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
36+
with:
37+
ref: main
38+
token: ${{ steps.generate_github_token.outputs.token }}
39+
40+
- uses: gradle/actions/wrapper-validation@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
41+
42+
- run: ./gradlew -Pversion=$VERSION writeVersionToExamples writeVersionToReadme setVersion nextMinorVersion snapshotVersion
43+
env:
44+
VERSION: ${{ github.event.inputs.version }}
45+
46+
- name: "Switch SDK to after release branch"
47+
run: |
48+
git fetch --depth=1 origin after-release || true
49+
git checkout -B after-release origin/after-release || true
50+
git checkout -B after-release
51+
git log -1
52+
53+
- name: "update changelog"
54+
run: |
55+
gh api /repos/commercetools/commercetools-sdk-java-v2/releases --paginate > releases.json
56+
node scripts/changelog.js > CHANGELOG.md
57+
rm -rf releases.json
58+
env:
59+
GH_TOKEN: ${{ steps.generate_github_token.outputs.token }}
60+
61+
- name: "remove API reference commit SHA"
62+
run: rm -rf reference.txt
63+
continue-on-error: true
64+
65+
- uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
66+
with:
67+
branch: after-release
68+
commit_message: "TASK: Updating version in README"
69+
commit_author: ct-sdks[bot] <${{ steps.get_app_user.outputs.email }}>
70+
commit_user_name: ct-sdks[bot]
71+
commit_user_email: ${{ steps.get_app_user.outputs.email }}
72+
73+
docs:
74+
name: Build and release docs
75+
76+
runs-on: ubuntu-latest
77+
steps:
78+
# Get GitHub token via the CT SDKs App
79+
- name: Generate GitHub token (via CT SDKs App)
80+
id: generate_github_token
81+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2
82+
with:
83+
app-id: ${{ secrets.CT_SDKS_APP_ID }}
84+
private-key: ${{ secrets.CT_SDKS_APP_PEM }}
85+
86+
- name: Get App user
87+
id: get_app_user
88+
env:
89+
GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }}
90+
run: |
91+
export GH_APP_USER=`gh api /users/ct-sdks%5Bbot%5D | jq .id`
92+
echo "email=${GH_APP_USER}+ct-sdks[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
93+
94+
- name: Checkout
95+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
96+
with:
97+
path: sdk
98+
token: ${{ steps.generate_github_token.outputs.token }}
99+
100+
- name: Checkout
101+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
102+
with:
103+
path: doc
104+
ref: gh-pages
105+
token: ${{ steps.generate_github_token.outputs.token }}
106+
107+
- name: Setup Java
108+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
109+
with:
110+
distribution: 'temurin'
111+
java-version: '17'
112+
113+
- name: Setup Graphviz
114+
uses: ts-graphviz/setup-graphviz@b1de5da23ed0a6d14e0aeee8ed52fdd87af2363c # v2.0.2
115+
116+
- run: ./gradlew -Pversion=$VERSION alljavadoc
117+
working-directory: sdk
118+
env:
119+
VERSION: ${{ github.event.inputs.version }}
120+
121+
122+
- run: rsync -r sdk/build/docs/javadoc/ doc/javadoc
123+
124+
- uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
125+
with:
126+
repository: doc
127+
commit_message: "Update javadoc"
128+
commit_author: ct-sdks[bot] <${{ steps.get_app_user.outputs.email }}>
129+
commit_user_name: ct-sdks[bot]
130+
commit_user_email: ${{ steps.get_app_user.outputs.email }}

0 commit comments

Comments
 (0)