From 1cba9e96d7233e5082b1d006c0bc2160726a867b Mon Sep 17 00:00:00 2001 From: Quentin Deroubaix <139884126+quentinderoubaix@users.noreply.github.com> Date: Tue, 10 Sep 2024 21:31:34 +0200 Subject: [PATCH] fix: patch build on release branches (#916) --- .github/workflows/build.yml | 11 +++++------ .github/workflows/release.yml | 1 - demo/scripts/updateStackblitzPkgs.js | 12 ++++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3105b79d77..eb368fe43f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,10 +13,6 @@ on: description: 'Version number (x.y.z) to set before executing the build' type: string default: '' - npmPublish: - description: 'Whether to publish the package on npm' - type: boolean - default: false docPublish: description: 'Whether to publish the documentation on gh-pages' type: boolean @@ -46,6 +42,7 @@ jobs: git config --global user.email github-actions@github.com - if: inputs.version != '' run: | + npm run -w demo update:stackblitzPkgs node scripts/setVersion.js "${{ inputs.version }}" npm run syncpack:check - run: npm run build:ci @@ -78,7 +75,7 @@ jobs: disable_search: true token: ${{ secrets.CODECOV_TOKEN }} - run: npm run -w verdaccio verdaccio-publish - - if: inputs.version != '' && inputs.npmPublish + - if: inputs.version != '' run: | npm whoami export PUBLISH_TAG="$(node ./scripts/publishTag.js "${{ inputs.version }}")" @@ -88,7 +85,9 @@ jobs: git commit -a -m v${{ inputs.version }} git tag v${{ inputs.version }} git show HEAD - git push origin v${{ inputs.version }} + export RELEASE_BRANCH=release/$(node scripts/versionDocFolder.js ${{ inputs.version }}) + git checkout -B $RELEASE_BRANCH + git push origin v${{ inputs.version }} $RELEASE_BRANCH env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - if: inputs.docPublish && (inputs.version != '' || inputs.docPath != '') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff44b6d9c8..e6641be746 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,6 @@ jobs: uses: './.github/workflows/build.yml' with: version: ${{ inputs.version }} - npmPublish: true docPublish: true secrets: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/demo/scripts/updateStackblitzPkgs.js b/demo/scripts/updateStackblitzPkgs.js index ab8e412a16..edb63f9bcd 100644 --- a/demo/scripts/updateStackblitzPkgs.js +++ b/demo/scripts/updateStackblitzPkgs.js @@ -7,14 +7,22 @@ const exec = promisify(execAsync); const version = process.argv[2]; +const updateDependency = (devDependencies, key, version) => { + if (version) { + devDependencies[key] = version; + } else { + delete devDependencies[key]; + } +}; + for (const framework of ['angular', 'react', 'svelte']) { for (const cssFwk of ['bootstrap', 'daisyui']) { const folder = join(import.meta.dirname, `../src/lib/stackblitz/${framework}-${cssFwk}`); const packageFile = join(folder, 'package.json'); const content = JSON.parse(await readFile(packageFile, 'utf8')); - content.devDependencies[`@agnos-ui/${framework}-${cssFwk === 'bootstrap' ? 'bootstrap' : 'headless'}`] = version; + updateDependency(content.devDependencies, `@agnos-ui/${framework}-${cssFwk === 'bootstrap' ? 'bootstrap' : 'headless'}`, version); if (framework === 'svelte') { - content.devDependencies['@agnos-ui/svelte-preprocess'] = version; + updateDependency(content.devDependencies, '@agnos-ui/svelte-preprocess', version); } await writeFile(packageFile, JSON.stringify(content, null, '\t') + '\n'); await exec(`npm install --package-lock-only --prefix ${folder}`);