Skip to content

Commit

Permalink
ci: remove config for next as a release branch
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschmidt committed Feb 5, 2024
1 parent cc5159c commit c1e529b
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 133 deletions.
80 changes: 0 additions & 80 deletions .github/workflows/pre-release.yml

This file was deleted.

49 changes: 27 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Create and Publish Full Release
name: Release
on:
push:
branches:
- main
- '*[0-9].*[0-9].x'
- '*[0-9].x.x'
- dev
- alpha
- beta
# workflow_dispatch makes it possible to trigger the run manually
workflow_dispatch:

Expand Down Expand Up @@ -43,28 +46,30 @@ jobs:
GH_TOKEN: ${{ secrets.CREATE_RELEASE }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ads }}
CI: true

merge-back-to-next:
needs: semantic-release
if: needs.semantic-release.outputs.new_release_published == 'true' && github.ref_name == 'main'
timeout-minutes: 2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Trigger update in lime-crm-building-blocks
if: steps.semantic.outputs.new_release_published == 'true' && github.ref_name == 'main'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PRIVATE_REPO_DISPATCH }}
event-type: update-lime-elements
repository: Lundalogik/lime-crm-building-blocks
client-payload: '{"version": "${{ steps.semantic.outputs.new_release_version }}"}'
- name: Trigger update in lime-crm-components
if: steps.semantic.outputs.new_release_published == 'true' && github.ref_name == 'main'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PRIVATE_REPO_DISPATCH }}
event-type: update-lime-elements
repository: Lundalogik/lime-crm-components
client-payload: '{"version": "${{ steps.semantic.outputs.new_release_version }}"}'
- name: Trigger update in lime-webclient
if: steps.semantic.outputs.new_release_published == 'true' && github.ref_name == 'main'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.CREATE_RELEASE }}
- name: Set Git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "Lime Technologies OSS"
- run: git fetch --unshallow
- run: git rebase
- run: git checkout next
- run: git rebase
- name: Merge release commit back to branch `next`
run: |
git merge --no-ff main -m 'chore(release): auto merge `main` back to `next` after release'
git push
token: ${{ secrets.PRIVATE_REPO_DISPATCH }}
event-type: update-lime-elements
repository: Lundalogik/lime-webclient
client-payload: '{"version": "${{ steps.semantic.outputs.new_release_version }}"}'

docs:
needs: semantic-release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: SonarCloud Scan
on:
push:
branches:
- next
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
Expand Down
3 changes: 1 addition & 2 deletions docs-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ <h1>Lime Elements Documentation</h1>
return b[2].substring(0, 1) > a[2].substring(0, 1) ? 1 : -1;
}
});
createLink(`versions/latest/`, 'Latest Official Release');
createLink(`versions/next/`, 'Latest nightly (Used by the Lime CRM Web Client)');
createLink(`versions/latest/`, 'Latest Release');
window.versions.forEach(function(version, index) {
createLink(`versions/${version}/`, version);
});
Expand Down
37 changes: 11 additions & 26 deletions publish-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ usage: npm run docs:publish [-- [--v=<version>] [--remove=<pattern>]
runs, like those publishing the docs for a pull request,
should NOT use this flag.
--noPruneOutdated
Do not remove docs for outdated patch- and next-versions.
Do not remove docs for outdated patch versions.
--noTeardown Run no cleanup at end of script. Implies --noCleanOnFail.
--noCleanOnFail Do not run cleanup if script fails. Unless --noTeardown
is set, cleanup will still be run if script is successful.
Expand Down Expand Up @@ -105,7 +105,7 @@ usage: npm run docs:publish [-- [--v=<version>] [--remove=<pattern>]
}

if (pruneOutdated) {
pruneOldPatchAndNextVersions();
pruneOldPatchVersions();
}

if (runPush) {
Expand Down Expand Up @@ -254,16 +254,16 @@ function copyBuildOutput() {

updateVersionList();

shell.echo('Copying docs-index.html from most recent `next` version');
shell.echo('Copying docs-index.html from `latest` version');
if (
shell.cp(
'-f',
'docsDist/versions/next/docs-index.html',
'docsDist/versions/latest/docs-index.html',
'docsDist/index.html',
).code !== 0
) {
shell.echo(
'[WARNING] Copying docs-index.html from most recent `next` failed. Not critical, continuing.',
'[WARNING] Copying docs-index.html from `latest` failed. Not critical, continuing.',
);
}
}
Expand All @@ -280,6 +280,10 @@ function updateVersionList() {

const files = fs
.readdirSync('versions')
// We need to filter out the symlinks to `latest` and `next` since they
// are not actual versions. We don't use `next` anymore, but we have a
// static symlink pointing to `latest`, to avoid breaking existing
// links to `next`.
.filter((file) => file !== 'latest' && file !== 'next');
fs.writeFileSync(
'versions.js',
Expand All @@ -293,16 +297,13 @@ function updateVersionList() {
// eligible as "Latest".
const fullVersions = files.filter((file) => file.match(/^[0-9].*/));
createSymlinkForRelease(fullVersions, 'latest');

// Keep only versions that begin with `NEXT-`.
const nextVersions = files.filter((file) => file.match(/^NEXT-.*/));
createSymlinkForRelease(nextVersions, 'next');
}

function pruneOldPatchAndNextVersions() {
function pruneOldPatchVersions() {
shell.cd('docsDist');
const files = fs
.readdirSync('versions')
// Never prune the `latest` and `next` symlinks.
.filter((file) => file !== 'latest' && file !== 'next');
shell.cd('..');

Expand Down Expand Up @@ -334,22 +335,6 @@ function pruneOldPatchAndNextVersions() {
});
// -------

// -------
// For any next-versions, only keep the latest one.
const nextVersionRegex = /^NEXT-(\d*)\.(\d*)\.(\d*)(.*)/;
const nextVersions = files.filter((file) => file.match(nextVersionRegex));

if (nextVersions.length > 1) {
nextVersions.sort(collator.compare);
nextVersions.reverse();
nextVersions.shift();

nextVersions.forEach((item) => {
versionsToDelete.push(item);
});
}
// -------

versionsToDelete.forEach((item) => {
remove(item);

Expand Down
3 changes: 1 addition & 2 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module.exports = {
branches: [
'main',
'+([0-9])?(.{+([0-9]),x}).x',
{ name: 'next', prerelease: true },
{ name: 'dev', prerelease: true },
{ name: 'beta', prerelease: true },
{ name: 'alpha', prerelease: true },
Expand Down Expand Up @@ -37,7 +36,7 @@ module.exports = {
{
message:
// eslint-disable-next-line no-template-curly-in-string
'chore(release): ${nextRelease.version} [release]\n\n${nextRelease.notes}',
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
],
[
Expand Down

0 comments on commit c1e529b

Please sign in to comment.