Skip to content

Commit 804d7bd

Browse files
apeirora-service-user[bot]mlenkeit
andcommitted
Release 2.0.18
Co-authored-by: Maximilian Lenkeit <maximilian.lenkeit@sap.com>
1 parent 199a47f commit 804d7bd

File tree

6 files changed

+260
-29
lines changed

6 files changed

+260
-29
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Downport from release to main
2+
# originally taken from:
3+
# https://github.tools.sap/kulturpass/kp-commerce/blob/0e9ebcde4c9a8b56b9f7a89f08a401080385367f/.github/workflows/sync-branches.yml
4+
5+
on:
6+
workflow_dispatch: # manual trigger
7+
push:
8+
branches:
9+
- release
10+
jobs:
11+
downport-changes:
12+
runs-on: ${{ fromJSON(vars.RUNNER_JSON) }}
13+
steps:
14+
# as this workflow creates a pull request at the end, we'll first retrieve a token
15+
# for our service user so that we commit on its behalf
16+
# see https://github.com/actions/create-github-app-token/blob/93c1f04d6f14ea5b416e7a8dfd80446101c6adef/README.md?plain=1#L92-L120
17+
- name: Create GitHub app token
18+
uses: actions/create-github-app-token@v2
19+
id: app-token
20+
with:
21+
app-id: ${{ fromJSON(vars.SERVICE_USER_ORG_SCOPED_READ_ACCESS).app-id }}
22+
private-key: ${{ secrets[fromJSON(vars.SERVICE_USER_ORG_SCOPED_READ_ACCESS).private-key-secret-name] }}
23+
- name: Get GitHub App User ID
24+
id: get-user-id
25+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
26+
env:
27+
GH_HOST: github.tools.sap
28+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
29+
GH_ENTERPRISE_TOKEN: ${{ steps.app-token.outputs.token }}
30+
- name: Configure Git
31+
run: |
32+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
33+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.tools.sap'
34+
35+
- name: Checkout repository
36+
uses: actions/checkout@v5
37+
with:
38+
fetch-depth: 0
39+
40+
- name: Fetch remote branches
41+
run: |
42+
git fetch origin --no-tags
43+
git branch --list '*/release*' --remote
44+
45+
- name: Create branch mapping
46+
uses: actions/github-script@v7
47+
id: branch-mapping
48+
with:
49+
script: |
50+
const branchMapping = {
51+
'release': 'main'
52+
}
53+
console.log({ branchMapping })
54+
return branchMapping
55+
56+
- name: Sync with next-in-line branch
57+
run: |
58+
git fetch origin
59+
if git show-ref --quiet origin/chore/downport-$GITHUB_REF_NAME
60+
then
61+
echo "Using existing branch"
62+
git checkout -f chore/downport-$GITHUB_REF_NAME
63+
git pull origin chore/downport-$GITHUB_REF_NAME || true
64+
65+
echo "Ref of chore/downport-$GITHUB_REF_NAME:"
66+
git show-ref chore/downport-$GITHUB_REF_NAME
67+
echo "Ref of origin/$GITHUB_REF_NAME:"
68+
git show-ref origin/$GITHUB_REF_NAME
69+
70+
git merge origin/$GITHUB_REF_NAME --no-ff --no-edit --no-verify --verbose
71+
else
72+
echo "Creating new branch"
73+
git branch -f chore/downport-$GITHUB_REF_NAME
74+
git checkout -f chore/downport-$GITHUB_REF_NAME
75+
fi
76+
git push origin chore/downport-$GITHUB_REF_NAME
77+
gh pr create --base $TARGET --head chore/downport-$GITHUB_REF_NAME --title "Chore: Latest $GITHUB_REF_NAME to $TARGET" --body "" || true
78+
env:
79+
TARGET: ${{ fromJSON(steps.branch-mapping.outputs.result)[github.ref_name] }}
80+
GH_HOST: github.tools.sap
81+
GH_ENTERPRISE_TOKEN: ${{ steps.app-token.outputs.token }}
82+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ yarn-error.log*
2828
# Vitepress
2929
.vitepress/cache
3030
.vitepress/dist
31+
32+
# Artifacts of prepare-publish.yml
33+
__all-authors.txt
34+
__authors.txt
35+
__co-authors.txt
36+
__message.txt

.vitepress/config.mts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import matter from 'gray-matter'
77
import path from 'node:path'
88
import { getBlogDate, resolveAuthors, rewriteBlogPath } from './util/blog';
99
import { estimateReadingTime } from './util/reading-time';
10+
import fs from 'node:fs'
11+
import { glob } from 'glob'
1012

1113
const BASE = process.env.VP_BASE || '/'
1214
if (!path.posix.isAbsolute(BASE)) {
@@ -147,6 +149,26 @@ export default withMermaid(defineConfig({
147149
map: null
148150
}
149151
}
152+
},
153+
{
154+
name: 'post-build-once',
155+
apply: 'build' as const,
156+
async closeBundle() {
157+
// some SVG files that were created with draw.io have built-in
158+
// support for light/dark mode. however, the color palette is not
159+
// complete, so it looks messy. as dark mode is anyway not supported
160+
// right now, we'll simply post-process all SVG and enforce light mode
161+
// on them.
162+
const files = await glob('.vitepress/dist/**/*.svg')
163+
files.forEach(filepath => {
164+
const svg = fs.readFileSync(filepath, 'utf-8')
165+
const pattern = /color-scheme: light dark/
166+
if (pattern.test(svg)) {
167+
const newSvg = svg.replace(pattern, 'color-schema: only light')
168+
fs.writeFileSync(filepath, newSvg)
169+
}
170+
})
171+
}
150172
}
151173
]
152174
},

0 commit comments

Comments
 (0)