Skip to content

Merge pull request #14 from AHTu21/feature/sticker-json #11

Merge pull request #14 from AHTu21/feature/sticker-json

Merge pull request #14 from AHTu21/feature/sticker-json #11

Workflow file for this run

# После merge/push в main: patch или minor по правилам docs/VERSIONING.md
name: Version bump on main
on:
push:
branches: [main]
permissions:
contents: write
jobs:
bump:
if: ${{ !contains(github.event.head_commit.message, 'chore(version):') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Labels смерженного PR
id: pr
uses: actions/github-script@v7
with:
script: |
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha,
});
const merged = prs.find((p) => p.merged_at);
const labels = (merged?.labels ?? []).map((l) => l.name).join(",");
core.setOutput("labels", labels);
- name: Рассчитать и записать версию
env:
VERSION_LABELS: ${{ steps.pr.outputs.labels }}
run: node scripts/bump-version-on-merge.mjs
- name: Коммит chore(version) и push (п.5 — версия в репозитории после merge)
run: |
FILES="package.json client/package.json server/package.json package-lock.json"
if git diff --quiet -- $FILES; then
echo "Версия не изменилась — коммит не нужен."
exit 0
fi
VER=$(node -p "require('./package.json').version")
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add $FILES
git commit -m "chore(version): bump to v${VER}"
git push