Skip to content

Commit

Permalink
Merge branch 'dev' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakutoc authored Feb 12, 2024
2 parents 1cb1442 + b801b4d commit 053547c
Show file tree
Hide file tree
Showing 37 changed files with 2,693 additions and 129 deletions.
21 changes: 0 additions & 21 deletions .autorc.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/actions/update-package-lock/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ runs:
# delete node_modules for all packages
lerna clean -y
# update package-lock.json file for all packages
lerna exec -- npm i --no-audit --no-progress --package-lock-only --ignore-scripts
lerna exec --no-private -- npm i --no-audit --no-progress --package-lock-only --ignore-scripts
# root deps don't update correctly on first regeneration O_o
npm i --package-lock-only
Expand All @@ -36,5 +36,5 @@ runs:
github_token: ${{ inputs.token }}
message: ${{ inputs.commit-message }}
branch: ${{ steps.branch_name.outputs.BRANCH }}
author_name: Salute Frontend Team
author_email: salute.developers@gmail.com
author_name: Alexander Lobyntsev
author_email: yakutoc@gmail.com
12 changes: 12 additions & 0 deletions .github/processing-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = function processingData() {
const arr = [
'plasma-web',
'plasma-ASDK',
'plasma-b2c',
'caldera',
].map((i) => `@salutejs/${i}`);

return {
"PACKAGES": JSON.stringify(arr)
}
}
31 changes: 31 additions & 0 deletions .github/read.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const getPackagesShortName = (list = [], dict) => {
return list
.filter((item) => dict.includes(item))
.map((item) => {
return item.replace('@salutejs/', '').replace('plasma-', '');
})
}

module.exports = () => {
const { PACKAGES_STORYBOOK, OUTPUT, PR_NAME = "pr-1021" } = process.env;

const packagesStorybook= JSON.parse(PACKAGES_STORYBOOK);
const output= JSON.parse(OUTPUT);

const links = [
`website: http://plasma.sberdevices.ru/pr/pr-${PR_NAME}/`,
];

getPackagesShortName(output, packagesStorybook).forEach((packageName) => {
links.push(`${packageName} storybook: http://plasma.sberdevices.ru/pr/pr-${PR_NAME}/${packageName}-storybook/`);
});

const message = `Documentation preview deployed!
${links.join('\n')}
`;

console.log(message);

return message;
}
29 changes: 29 additions & 0 deletions .github/workflows/changelog-builder-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"categories": [
{
"title": "## Components",
"labels": ["components"]
},
{
"title": "## Icons",
"labels": ["plasma-icons"]
},
{
"title": "## Uncategorized",
"labels": []
}
],
"ignore_labels": ["skip"],
"pr_template": "#{{DESC}}\n#{{TITLE}} (#{{URL}})\n",
"custom_placeholders": [
{
"name": "DESC",
"source": "BODY",
"transformer": {
"pattern": "(?:\n### What\/why changed)(.*)",
"flags": "s",
"target": " "
}
}
]
}
33 changes: 19 additions & 14 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,28 @@ on:
jobs:
run:
name: Check Health
if: ${{ !startsWith(github.head_ref, 'release') }}

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
- name: Use state
id: state
uses: actions/github-script@v7
with:
node-version-file: '.nvmrc'

- name: Install
run: npm ci --no-audit

- name: Lerna bootstrap
run: npx lerna bootstrap
debug: true
script: |
const {
issue: { number },
repo: { owner, repo }
} = context;
console.log(number);
console.log(context);
- name: Lint
run: npm run lint
context:
uses: ./.github/workflows/reuse.yml
secrets: inherit
55 changes: 55 additions & 0 deletions .github/workflows/notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Create release PR

on:
workflow_dispatch:
branches:
- main

jobs:
release-notes:
name: Build Changelog
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

permissions:
contents: read
pull-requests: read

steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
fetch-depth: 0

- name: Computed envs
run: |
echo "DATE=$(date +'%d.%m.%Y')" >> $GITHUB_ENV
echo "FROM_TAG=$(git merge-base --fork-point origin/main)" >> $GITHUB_ENV
echo "FILE_PATH=${{ github.workspace }}/changelog_artifacts.md" >> $GITHUB_ENV
- name: Build Changelog
id: github_release
uses: mikepenz/[email protected]
with:
fromTag: ${{ env.FROM_TAG }}
toTag: ${{ github.sha }}
configuration: "./.github/workflows/changelog-builder-config.json"

- name: Create "changelog_artifacts.md"
run: |
cat > ${{ env.FILE_PATH }} <<'EOF'
${{ steps.github_release.outputs.changelog }}
- name: Upload "changelog_artifacts.md"
uses: actions/upload-artifact@master
with:
name: release-changelog-artifacts
path: ${{ env.FILE_PATH }}

- name: Create release PR
run: |
changelog='${{ steps.github_release.outputs.changelog }}'
gh pr create --base main --head ${{ github.ref_name }} --title "Release by ${{ env.DATE }}" --body "# Release Notes
$changelog"
54 changes: 54 additions & 0 deletions .github/workflows/publish-blank-mq.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release

on:
merge_group:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false

- name: One
id: pr_state
uses: actions/github-script@v6
with:
script: |
console.log(context);
console.log(context.repo.owner);
console.log(context.repo.repo);
const teammate = {
Yakutoc: "alex_czech",
'neretin-trike': "aaneretin",
'Yeti-or': "yeti-or",
TitanKuzmich: "aakrivonos",
kayman233: "ivakudryavtsev",
};
const res = await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.payload.merge_group.head_sha,
owner: context.repo.owner,
repo: context.repo.repo,
});
console.log(res);
const { title, user: { login = "alex_czech" } } = res?.data[0] || {};
return { pr: title, user: teammate[login] || 'alex_czech' };
- name: Create the Mattermost Message
if: ${{ success() }}
run: |
title=${{ fromJSON(steps.pr_state.outputs.result).pr }}
user=${{ fromJSON(steps.pr_state.outputs.result).user }}
echo "{\"text\":\"$title - In progress\\n@user\"}" > mattermost.json
- name: Send notification
uses: mattermost/action-mattermost-notify@master
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.WEBHOOKS_NOTIFICATIONS_MM }}
8 changes: 8 additions & 0 deletions .github/workflows/publish-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ on:
- dev

jobs:
authorize:
name: Authorize external pull request
if: ${{ !startsWith(github.head_ref, 'release') }}

uses: ./.github/workflows/auth.yml

publish:
name: Canary version
uses: ./.github/workflows/publish-common.yml
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
auto-options: '--no-changelog'
upload_assets: false
secrets:
gh_token: ${{ secrets.GH_TOKEN }}
npm_registry_token: ${{ secrets.NPM_REGISTRY_TOKEN }}
10 changes: 8 additions & 2 deletions .github/workflows/publish-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ on:
ref:
type: string
default: ''
auto-options:
type: string
description: "@auto-it cli arguments for example --no-changelog"
default: ''
upload_assets:
type: boolean
secrets:
gh_token:
required: true
Expand Down Expand Up @@ -52,8 +58,8 @@ jobs:
- name: Release Info
run: npm whoami && npx lerna info && npx auto info || echo 'auto info returned 1'

- name: Create Release
run: npm run release
- name: Release
run: upload_assets="${{ inputs.upload_assets }}" npm run release -- ${{ inputs.auto-options }}

- name: Update package-lock files
if: ${{ inputs.with-update-package-lock }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ jobs:
secrets:
gh_token: ${{ secrets.GH_TOKEN }}
npm_registry_token: ${{ secrets.NPM_REGISTRY_TOKEN }}

Loading

0 comments on commit 053547c

Please sign in to comment.