mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
ci: Update release process to support major
releases (no-changelog) (#6552)
This commit is contained in:
parent
52e9882a32
commit
48a32e384a
22
.github/scripts/update-changelog.mjs
vendored
22
.github/scripts/update-changelog.mjs
vendored
|
@ -7,10 +7,13 @@ import { dirname } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import stream from 'stream';
|
import stream from 'stream';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
|
import packageJson from '../../package.json' assert { type: 'json' };
|
||||||
|
|
||||||
const pipeline = promisify(stream.pipeline);
|
const pipeline = promisify(stream.pipeline);
|
||||||
|
|
||||||
const changelogFile = resolve(dirname(fileURLToPath(import.meta.url)), '../../CHANGELOG.md');
|
const baseDir = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
|
||||||
|
const fullChangelogFile = resolve(baseDir, 'CHANGELOG.md');
|
||||||
|
const versionChangelogFile = resolve(baseDir, `CHANGELOG-${packageJson.version}.md`);
|
||||||
|
|
||||||
const changelogStream = conventionalChangelog({
|
const changelogStream = conventionalChangelog({
|
||||||
preset: 'angular',
|
preset: 'angular',
|
||||||
|
@ -24,13 +27,16 @@ const changelogStream = conventionalChangelog({
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// We need to duplicate the stream here to pipe the changelog into two separate files
|
||||||
|
const stream1 = new stream.PassThrough();
|
||||||
|
const stream2 = new stream.PassThrough();
|
||||||
|
changelogStream.pipe(stream1);
|
||||||
|
changelogStream.pipe(stream2);
|
||||||
|
|
||||||
|
await pipeline(stream1, createWriteStream(versionChangelogFile));
|
||||||
|
|
||||||
// Since we can't read and write from the same file at the same time,
|
// Since we can't read and write from the same file at the same time,
|
||||||
// we use a temporary file to output the updated changelog to.
|
// we use a temporary file to output the updated changelog to.
|
||||||
const tmpFile = createTempFile();
|
const tmpFile = createTempFile();
|
||||||
await pipeline(
|
await pipeline(stream2, addStream(createReadStream(fullChangelogFile)), createWriteStream(tmpFile)),
|
||||||
changelogStream,
|
await pipeline(createReadStream(tmpFile), createWriteStream(fullChangelogFile));
|
||||||
addStream(createReadStream(changelogFile)),
|
|
||||||
createWriteStream(tmpFile),
|
|
||||||
);
|
|
||||||
|
|
||||||
await pipeline(createReadStream(tmpFile), createWriteStream(changelogFile));
|
|
||||||
|
|
22
.github/workflows/release-create-pr.yml
vendored
22
.github/workflows/release-create-pr.yml
vendored
|
@ -35,37 +35,33 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: ${{ github.event.inputs.base-branch }}
|
ref: ${{ github.event.inputs.base-branch }}
|
||||||
|
|
||||||
- name: Push the base branch
|
|
||||||
run: |
|
|
||||||
git checkout -b "release/${{ github.event.inputs.release-type }}"
|
|
||||||
git push -f origin "release/${{ github.event.inputs.release-type }}"
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v2.2.4
|
- uses: pnpm/action-setup@v2.2.4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version: 18.x
|
||||||
|
|
||||||
- run: npm install --prefix=.github/scripts --no-package-lock
|
- run: npm install --prefix=.github/scripts --no-package-lock
|
||||||
|
|
||||||
- name: Bump package versions
|
- name: Bump package versions
|
||||||
run: |
|
run: |
|
||||||
echo "NEXT_RELEASE=$(node .github/scripts/bump-versions.mjs)" >> $GITHUB_ENV
|
echo "NEXT_RELEASE=$(node .github/scripts/bump-versions.mjs)" >> $GITHUB_ENV
|
||||||
pnpm i --lockfile-only
|
|
||||||
env:
|
env:
|
||||||
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
|
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
|
||||||
|
|
||||||
- name: Update Changelog
|
- name: Update Changelog
|
||||||
run: node .github/scripts/update-changelog.mjs
|
run: node .github/scripts/update-changelog.mjs
|
||||||
|
|
||||||
|
- name: Push the base branch
|
||||||
|
run: |
|
||||||
|
git push -f origin refs/remotes/origin/${{ github.event.inputs.base-branch }}:refs/heads/release/${{ env.NEXT_RELEASE }}
|
||||||
|
|
||||||
- name: Push the release branch, and Create the PR
|
- name: Push the release branch, and Create the PR
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v5
|
||||||
with:
|
with:
|
||||||
base: 'release/${{ github.event.inputs.release-type }}'
|
base: 'release/${{ env.NEXT_RELEASE }}'
|
||||||
branch: 'release/${{ env.NEXT_RELEASE }}'
|
branch: '${{ env.NEXT_RELEASE }}-pr'
|
||||||
commit-message: ':rocket: Release ${{ env.NEXT_RELEASE }}'
|
commit-message: ':rocket: Release ${{ env.NEXT_RELEASE }}'
|
||||||
delete-branch: true
|
delete-branch: true
|
||||||
labels: 'release'
|
labels: 'release'
|
||||||
title: ':rocket: Release ${{ env.NEXT_RELEASE }}'
|
title: ':rocket: Release ${{ env.NEXT_RELEASE }}'
|
||||||
# 'TODO: add generated changelog to the body. create a script to generate custom changelog'
|
body-path: 'CHANGELOG-${{ env.NEXT_RELEASE }}.md'
|
||||||
body: ''
|
|
||||||
|
|
||||||
# TODO: post PR link to slack
|
|
||||||
|
|
4
.github/workflows/release-publish.yml
vendored
4
.github/workflows/release-publish.yml
vendored
|
@ -5,8 +5,7 @@ on:
|
||||||
types:
|
types:
|
||||||
- closed
|
- closed
|
||||||
branches:
|
branches:
|
||||||
- 'release/patch'
|
- 'release/*'
|
||||||
- 'release/minor'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-release:
|
publish-release:
|
||||||
|
@ -50,6 +49,7 @@ jobs:
|
||||||
tag: 'n8n@${{env.RELEASE}}'
|
tag: 'n8n@${{env.RELEASE}}'
|
||||||
prerelease: true
|
prerelease: true
|
||||||
makeLatest: false
|
makeLatest: false
|
||||||
|
body: ${{github.event.pull_request.body}}
|
||||||
|
|
||||||
- name: Trigger a release note
|
- name: Trigger a release note
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -20,3 +20,4 @@ packages/**/.turbo
|
||||||
cypress/videos/*
|
cypress/videos/*
|
||||||
cypress/screenshots/*
|
cypress/screenshots/*
|
||||||
*.swp
|
*.swp
|
||||||
|
CHANGELOG-*.md
|
||||||
|
|
Loading…
Reference in a new issue