Skip to content

Commit 18c74b5

Browse files
committed
chore: 🤖 Merge branch 'dbux-3' into feat-dbswc-323-link
2 parents 416ea0c + 9860550 commit 18c74b5

File tree

193 files changed

+5559
-7347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+5559
-7347
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
source/fonts/**/sources/
33
helpers/test.js
44
tests/backstop_data/engine_scripts/
5+
out/**
6+
dist/**
7+
**/*.min.js

.eslintrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
node: true
6+
},
7+
extends: ['eslint:recommended'],
8+
rules: {
9+
'no-console': 'error'
10+
}
11+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: "Cancel Workflow"
3+
description: "Cancel this workflow on failure"
4+
inputs:
5+
token:
6+
description: "A Github PAT"
7+
required: true
8+
runs:
9+
using: "composite"
10+
steps:
11+
- run: |
12+
gh api \
13+
--method POST \
14+
-H "Accept: application/vnd.github+json" \
15+
/repos/db-ui/core/actions/runs/${{ github.run_id }}/cancel
16+
shell: bash
17+
env:
18+
GH_TOKEN: ${{ inputs.token }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: "Download Tar Artifact"
3+
description: "Downloads an artifact and unzips it"
4+
inputs:
5+
name:
6+
description: "Name for artifact"
7+
required: true
8+
path:
9+
description: "Path for unzip"
10+
required: true
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: ⬇ Download build
15+
uses: actions/download-artifact@v3
16+
with:
17+
name: ${{ inputs.name }}
18+
19+
- name: 📁 Manage path folder
20+
run: |
21+
if [ ! -d ${{ inputs.path }} ]; then
22+
mkdir ${{ inputs.path }}
23+
fi
24+
export amount=1
25+
export path="${{ inputs.path }}"
26+
if [[ "$path" == *\/* ]] || [[ "$path" == *\\* ]]
27+
then
28+
export slashes=$(grep -o "/" <<<"$path" | wc -l)
29+
export amount=$((amount + slashes))
30+
fi
31+
echo "##[set-output name=amount;]$(echo ${amount})"
32+
shell: bash
33+
id: manage-path-folder
34+
35+
- name: 📦 Unpack Tar
36+
run: tar -zxf ${{ inputs.name }} -C ${{ inputs.path }} --strip-components ${{ steps.manage-path-folder.outputs.amount }}
37+
shell: bash
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: "Extract branch name"
3+
description: "Extract branch name based on pr or push"
4+
outputs:
5+
branch-name:
6+
description: "Branch name"
7+
value: ${{ steps.branch-name.outputs.branch-name }}
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: ⏬ Get branch name
12+
uses: actions/github-script@v6
13+
id: get-branch-name
14+
with:
15+
result-encoding: string
16+
script: |
17+
return (
18+
context?.payload?.pull_request?.head?.ref ||
19+
context?.payload?.ref || ""
20+
).replace("refs/heads/","");
21+
- name: 🪑 Set output
22+
id: branch-name
23+
run: echo "::set-output name=branch-name::$(echo $BRANCH_NAME)"
24+
shell: bash
25+
env:
26+
BRANCH_NAME: ${{steps.get-branch-name.outputs.result}}

.github/scripts/auto-update-pr.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = async ({ github, context }, head, base) => {
2+
try {
3+
const { repo, owner } = context.repo;
4+
const result = await github.rest.pulls.create({
5+
title: 'Auto Update from main',
6+
owner,
7+
repo,
8+
head,
9+
base,
10+
body: '(o゜▽゜)o ☆ ☜(゚ヮ゚☜)'
11+
});
12+
13+
await github.rest.issues.addLabels({
14+
owner,
15+
repo,
16+
issue_number: result.data.number,
17+
labels: ['automated update']
18+
});
19+
20+
return result.data.html_url;
21+
} catch (e) {
22+
console.error(e);
23+
}
24+
return false;
25+
};

.github/scripts/build-gh-page.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ $NAME == "true" ]]; then
4+
echo "Erro: Missing NAME variable"
5+
exit 1
6+
fi
7+
8+
echo "➕ Create temp or public dir: $NAME"
9+
if [[ $RELEASE == "true" ]]; then
10+
mkdir temp
11+
echo " Created 'temp' dir"
12+
else
13+
mkdir public
14+
echo " Created 'public' dir"
15+
fi
16+
17+
18+
echo "📥 Get gh-pages tar"
19+
curl -L https://github.com/db-ui/core/tarball/gh-pages --output gh-pages
20+
21+
echo "📦 Unpack Tar"
22+
if [[ $RELEASE == "true" ]]; then
23+
tar -zxf gh-pages -C temp --strip-components 1
24+
else
25+
tar -zxf gh-pages -C public --strip-components 1
26+
fi
27+
28+
echo "📁 Bundle public"
29+
if [[ $RELEASE == "true" ]]; then
30+
echo " Move ./out ./public"
31+
mv ./out ./public
32+
cp -R ./public out
33+
if [ -d ./temp/review ]; then
34+
echo " Move ./temp/review ./public"
35+
mv ./temp/review ./public
36+
fi
37+
if [ -d ./temp/version ]; then
38+
echo " Move ./temp/version ./public"
39+
mv ./temp/version ./public
40+
fi
41+
fi
42+
43+
if [[ $PRE_RELEASE == "true" || $RELEASE == "true" ]]; then
44+
if [[ ! -d ./public/version ]]; then
45+
echo " Make dir ./public/version"
46+
mkdir ./public/version
47+
fi
48+
if [[ -d ./public/version/"$NAME" ]]; then
49+
echo " Remove dir ./public/version/$NAME"
50+
rm -rf ./public/version/"$NAME"
51+
fi
52+
mv ./out ./public/version/"$NAME"
53+
else
54+
if [[ ! -d ./public/review ]]; then
55+
echo " Make dir ./public/review"
56+
mkdir ./public/review
57+
fi
58+
if [[ -d ./public/review/"$NAME" ]]; then
59+
echo " Remove dir ./public/review/$NAME"
60+
rm -rf ./public/review/"$NAME"
61+
fi
62+
mv ./out ./public/review/"$NAME"
63+
fi

.github/scripts/cleanup-gh-pages.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Fetches all branches and deletes all review-branches in github pages
3+
*/
4+
const FS = require('fs');
5+
6+
const TAG = 'cleanup-gh-pages:';
7+
8+
const removeOldFromPath = (isTag, data) => {
9+
const path = `public/${isTag ? 'version' : 'review'}`;
10+
if (FS.existsSync(path) && data?.length > 0) {
11+
const dirsToDelete = FS.readdirSync(path).filter(
12+
(file) => !data.find((branch) => branch.name === file)
13+
);
14+
if (dirsToDelete?.length > 0) {
15+
console.log(
16+
TAG,
17+
`Start removing ${isTag ? 'tags' : 'branches'} from gh-pages`
18+
);
19+
console.log(TAG, dirsToDelete);
20+
dirsToDelete.forEach((dir) => {
21+
FS.rmSync(`${path}/${dir}`, {
22+
recursive: true,
23+
force: true
24+
});
25+
console.log(TAG, `deleted ${isTag ? 'tag' : 'branch'} ${dir}`);
26+
});
27+
return true;
28+
} else {
29+
console.log(
30+
TAG,
31+
`All ${isTag ? 'tags' : 'branches'} are up to date`
32+
);
33+
}
34+
}
35+
36+
return false;
37+
};
38+
39+
module.exports = async ({ github, context }) => {
40+
const { repo, owner } = context.repo;
41+
const branches = await github.rest.repos.listBranches({
42+
owner,
43+
repo
44+
});
45+
const tags = await github.rest.repos.listTags({
46+
owner,
47+
repo
48+
});
49+
50+
return {
51+
deploy:
52+
removeOldFromPath(false, branches.data) ||
53+
removeOldFromPath(true, tags.data)
54+
};
55+
};

.github/scripts/get-release.sh

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@
22

33
if [[ $GITHUB_REF == refs/tags/v* ]]
44
then
5-
if [[ $GITHUB_ACTOR != 'dependabot[bot]' ]]
6-
then
7-
8-
if [[ $GITHUB_PRE_RELEASE == true ]]
9-
then
10-
echo "PRE_RELEASE"
11-
elif [[ $GITHUB_COMMITISH == 'main' ]]
12-
then
13-
echo "RELEASE"
14-
fi
15-
else
16-
echo "Dependabot has no permission to publish!"
17-
exit 1
18-
fi
5+
if [[ $GITHUB_ACTOR != 'dependabot[bot]' ]]
6+
then
7+
if [[ $GITHUB_COMMITISH == 'main' && $GITHUB_PRE_RELEASE == false ]]
8+
then
9+
echo "RELEASE"
10+
else
11+
echo "PRE_RELEASE"
12+
fi
13+
else
14+
echo "Dependabot has no permission to publish!"
15+
exit 1
16+
fi
1917
else
20-
echo "Your tag has to start with 'v'"
21-
exit 1
18+
echo "Your tag has to start with 'v'"
19+
exit 1
2220
fi

.github/scripts/publish-npm.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ fi
1313
echo "🛠 Forge all packages version numbers"
1414
echo "which package version ?: $VALID_SEMVER_VERSION"
1515

16-
npm version --no-git-tag-version "$VALID_SEMVER_VERSION"
16+
npm version --no-git-tag-version "$VALID_SEMVER_VERSION"
1717

1818
echo "📦 Create packages"
19-
npm pack --quiet
19+
npm pack --quiet
2020

2121
TAG="latest"
22-
if [[ $PRE_RELEASE == 'true' ]]; then
22+
if [[ "$GITHUB_COMMITISH" =~ dbux-[0-9]+ ]];then
23+
TAG=$GITHUB_COMMITISH
24+
elif [[ $PRE_RELEASE == 'true' ]]; then
2325
TAG="next"
2426
fi
2527

26-
echo "📰 Publish Package to Registry with tag: $TAG)"
28+
echo "📰 Publish Package to Registry with tag: $TAG"
2729
for REGISTRY in 'GITHUB' 'NPM'
2830
do
2931
echo "🔒 Authenticate $REGISTRY NPM Registry"

.github/workflows/00-init.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: 🛑 Cancel Previous Runs
12-
uses: styfle/cancel-workflow-action@0.10.0
12+
uses: styfle/cancel-workflow-action@0.11.0
1313

1414
- name: ⬇️ Checkout repo
1515
uses: actions/checkout@v3
@@ -20,3 +20,9 @@ jobs:
2020
- name: 📥 Download deps default-npm-cache
2121
if: steps.npm-cache.outputs.cache-hit != 'true'
2222
uses: bahmutov/npm-install@v1
23+
24+
- name: 💀 Killing me softly
25+
uses: ./.github/actions/cancel-workflow
26+
if: failure()
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/00-scan-secrets.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Leaked Secrets Scan
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
TruffleHog:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: ⬇ Checkout repo
11+
uses: actions/checkout@v3
12+
with:
13+
fetch-depth: 0
14+
15+
- name: ↔ Extract branch name
16+
uses: ./.github/actions/extract-branch
17+
id: extract_branch
18+
19+
- name: 🐷 TruffleHog OSS
20+
uses: trufflesecurity/[email protected]
21+
with:
22+
path: ./
23+
base: ${{ steps.extract_branch.outputs.branch-name }}
24+
head: HEAD
25+
26+
- name: 💀 Killing me softly
27+
uses: ./.github/actions/cancel-workflow
28+
if: failure()
29+
with:
30+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/01-build.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,26 @@ jobs:
1717
- name: 🍼 Create pages build
1818
run: npm run build
1919

20-
- name: ️Upload page build
21-
uses: actions/upload-artifact@v3
20+
- name: Upload dist
21+
uses: ./.github/actions/upload-tar-artifact
2222
with:
23-
name: build
24-
path: public
23+
name: assets
24+
path: dist
2525

26-
- name: ️Upload package build
27-
uses: actions/upload-artifact@v3
26+
- name: Upload sources
27+
uses: ./.github/actions/upload-tar-artifact
2828
with:
29-
name: package
30-
path: |
31-
dist/
32-
sources/
29+
name: css-sources
30+
path: sources
31+
32+
- name: ⬆ Upload out
33+
uses: ./.github/actions/upload-tar-artifact
34+
with:
35+
name: patternlab
36+
path: out
37+
38+
- name: 💀 Killing me softly
39+
uses: ./.github/actions/cancel-workflow
40+
if: failure()
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)