5.3.5 • Published 7 months ago

bootstrap-automatic-releases v5.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Set up

This repository is a copy of the Bootstrap repository with a few changes to make it work with this new repository:

  • Forked Bootstrap main branch from https://github.com/twbs/bootstrap/commit/0cbfe13adf669ad39ae9d8e873c2ad59befd3a3a
  • Changed if: github.repository == 'twbs/bootstrap' to if: github.repository == 'julien-deramond/bootstrap-automatic-releases' (3e17b6e)
  • Removed .github/dependabot.yml file to avoid having Dependabot alerts
  • Fixed CSpell action by adding "deramond" to the dictionary (45bd8d9)
  • Disabled BrowserStack workflow because it requires a BrowserStack account. However, it should be pretty easy to make it work afterward when the automatic release is set up in Bootstrap. (77eb394)
  • Configured Netlify to deploy the main branch at https://bootstrap-automatic-releases.netlify.app/
  • Changed package name for this repository in package.json to test out the automatic release: used bootstrap-automatic-releases

    • This also required changing the name here:
    diff --git a/build/zip-examples.mjs b/build/zip-examples.mjs
    index e5e39be..df254dc 100644
    --- a/build/zip-examples.mjs
    +++ b/build/zip-examples.mjs
    @@ -18,7 +18,7 @@ const pkgJson = path.join(__dirname, '../package.json')
    const pkg = JSON.parse(await fs.readFile(pkgJson, 'utf8'))
    
    const versionShort = pkg.config.version_short
    -const distFolder = `bootstrap-${pkg.version}-examples`
    +const distFolder = `bootstrap-automatic-releases-${pkg.version}-examples`
    const rootDocsDir = '_site'
    const docsDir = `${rootDocsDir}/docs/${versionShort}/`
    
    diff --git a/package.json b/package.json
    index 7c3d4b4..90e3715 100644
    --- a/package.json
    +++ b/package.json
    @@ -89,7 +89,7 @@
        "release": "npm-run-all dist release-sri docs-build release-zip*",
        "release-sri": "node build/generate-sri.mjs",
        "release-version": "node build/change-version.mjs",
    -    "release-zip": "cross-env-shell \"rm -rf bootstrap-$npm_package_version-dist bootstrap-$npm_package_version-dist.zip && cp -r dist/ bootstrap-$npm_package_version-dist && zip -qr9 bootstrap-$npm_package_version-dist.zip bootstrap-$npm_package_version-dist && rm -rf bootstrap-$npm_package_version-dist\"",
    +    "release-zip": "cross-env-shell \"rm -rf bootstrap-automatic-releases-$npm_package_version-dist bootstrap-automatic-releases-$npm_package_version-dist.zip && cp -r dist/ bootstrap-automatic-releases-$npm_package_version-dist && zip -qr9 bootstrap-automatic-releases-$npm_package_version-dist.zip bootstrap-automatic-releases-$npm_package_version-dist && rm -rf bootstrap-automatic-releases-$npm_package_version-dist\"",
        "release-zip-examples": "node build/zip-examples.mjs",
        "dist": "npm-run-all --aggregate-output --parallel css js",
        "test": "npm-run-all lint dist js-test docs-build docs-lint",

Changes

Here are the changes that could be made to the original Bootstrap repository to have automatic releases.

Get rid of the dist directory

  • Remove dist directory and add it to .gitignore (c0797cb)
  • Add eslint ignore rule eslint-disable-line import/no-unresolved to /js/tests/integration/bundle.js to fix npm run lint without having to build the library (6d959ab)
  • Change npm run docs to add an extra npm run dist command so that /docs/5.3/customize/css-variables can be built (it embeds the content of the dist CSS built file) (d8d05b0)
  • Adapt .github/workflows/docs.yml to use npm run docs instead of several sub-commands (8dacbe0)
  • Adapt BrowserStack workflow (not done here because it requires a BrowserStack account)

Prepare the releases

  • New script prepare-version.mjs that takes 'patch', 'minor', or 'major' as an argument and prepares the main branch for the next release.
    • Changes the version in all files
    • Rename the {version} directories (e.g. 5.3 -> 5.4, or 5.3 -> 6.0) for minor and major versions
  • New npm scripts to prepare the main branch for the next release:
    + "prepare-patch": "node build/prepare-version.mjs patch",
    + "prepare-minor": "node build/prepare-version.mjs minor",
    + "prepare-major": "node build/prepare-version.mjs major",

Release

!NOTE This test was done by publishing this https://www.npmjs.com/package/bootstrap-automatic-releases package publicly. It will be deleted afterward.

!WARNING It would be possible to use GitHub Actions to publish the package to npm, but it would require a npm token. If the action is not set up correctly, the token could be exposed. Moreover, all the core team (with write access) is not currently allowed to publish to npm. Therefore, it would be better to use the manual process for now.

New scripts

  • publish-release: to run the release script, publish the package to npm, push the changes to the main branch, and create/push a new tag
  • publish-patch: to run the publish-release script, and after that, publish the docs to the gh-pages branch too
  • publish-minor: to run the publish-release script, and after that, publish the docs to the gh-pages branch too
  • publish-major: to run the publish-release script, and after that, publish the docs to the gh-pages branch too
  • build/publish-docs.mjs: to publish the docs to the gh-pages branch

How to publish a new release for a patch version

  • Run npm run publish-patch to publish a new patch version

How to publish a new release for a minor version

How to publish a new release for a major version

After the release

Prepare the main branch for the next release by running:

  • npm run prepare-patch for a patch release
  • npm run prepare-minor for a minor release
  • npm run prepare-major for a major release

This will execute the npm run release-version <version> <next-version>. For example, if the current version is 5.3.0, running npm run prepare-patch will execute npm run release-version 5.3.0 5.3.1.

5.3.5

7 months ago

5.3.3

7 months ago