mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-26 13:07:33 +09:00
- Update engines.node in all package.json files - Update .nvmrc to 22 - Update GitHub Actions workflows to node-version: 22
104 lines
3.4 KiB
YAML
104 lines
3.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const latestRelease = await github.rest.repos.getLatestRelease({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
})
|
|
const commits = await github.rest.repos.compareCommitsWithBasehead({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
basehead: `refs/tags/${latestRelease.data.tag_name}...${context.ref}`,
|
|
})
|
|
|
|
const groups = {
|
|
feat: [`## Features\n`],
|
|
fix: [`## Fixes\n`],
|
|
docs: [`## Documentation\n`],
|
|
experimental: [`## Experimental\n`],
|
|
other: [`## Other changes\n`],
|
|
}
|
|
for (const commit of commits.data.commits) {
|
|
const match = commit.commit.message.match(/^(?<type>\w+)\s*:\s*(?<message>.+)\n*/)
|
|
const type = match?.groups?.type
|
|
const message = match?.groups?.message
|
|
if (type && message) {
|
|
const availableType = type in groups ? type : 'other'
|
|
const capitalized = message[0].toLocaleUpperCase() + message.slice(1)
|
|
groups[availableType].push(`- ${capitalized} by @${commit.author.login}`)
|
|
}
|
|
}
|
|
|
|
const tag_name = context.ref.slice('refs/tags/'.length)
|
|
const fullChangelog = `**Full Changelog**: https://github.com/${context.repo.owner}/${context.repo.repo}/compare/${latestRelease.data.tag_name}...${tag_name}`
|
|
const changelog = Object.values(groups)
|
|
.filter(lines => lines.length > 1)
|
|
.map(lines => lines.join('\n'))
|
|
.concat(fullChangelog)
|
|
.join('\n\n')
|
|
console.info(changelog)
|
|
|
|
await github.rest.repos.createRelease({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
tag_name,
|
|
name: tag_name,
|
|
body: changelog,
|
|
})
|
|
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
environment:
|
|
name: development
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.ref }} # tag name
|
|
- uses: ./.github/actions/submodules-checkout
|
|
with:
|
|
submodules-ssh-key: ${{ secrets.PRIVATE_GITHUB_DEPLOY_TOKEN }}
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- id: version
|
|
run: echo "value=$(echo ${{ github.ref }} | sed 's/refs\/tags\///')" >> $GITHUB_OUTPUT
|
|
- name: bump version to ${{ steps.version.outputs.value }}
|
|
run: |
|
|
pnpx replace-in-files-cli \
|
|
--string="0.0.0-webstudio-version" \
|
|
--replacement="${{ steps.version.outputs.value }}" \
|
|
"**/package.json"
|
|
|
|
- name: pnpm instal
|
|
run: pnpm install --ignore-scripts
|
|
- run: pnpm --filter="webstudio..." build
|
|
- run: pnpm --filter="webstudio..." dts
|
|
|
|
- name: Creating .npmrc
|
|
run: |
|
|
cat << EOF > "$HOME/.npmrc"
|
|
//registry.npmjs.org/:_authToken=$NPM_TOKEN
|
|
EOF
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
- run: pnpm -r publish --access public --no-git-checks
|