Skip to content

Commit

Permalink
fix: patch build on release branches (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinderoubaix committed Sep 10, 2024
1 parent 439beaa commit 1cba9e9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -46,6 +42,7 @@ jobs:
git config --global user.email [email protected]
- 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
Expand Down Expand Up @@ -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 }}")"
Expand All @@ -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 != '')
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
uses: './.github/workflows/build.yml'
with:
version: ${{ inputs.version }}
npmPublish: true
docPublish: true
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 10 additions & 2 deletions demo/scripts/updateStackblitzPkgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down

0 comments on commit 1cba9e9

Please sign in to comment.