Conversation
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["Main"] |
There was a problem hiding this comment.
runs only if Main workflow completed
|
|
||
| jobs: | ||
| publish: | ||
| if: ${{ github.event.workflow_run.conclusion == 'success' }} |
There was a problem hiding this comment.
runs only on succesful completion of main.yml
.github/workflows/publish.yml
Outdated
| - run: bun install | ||
| - name : update changelog | ||
| id: update-changelog | ||
| run: bun run update-changelog |
There was a problem hiding this comment.
run update changelog script and use exit code 0 or 1 to know how to proceed next
.github/workflows/publish.yml
Outdated
| - name : update changelog | ||
| id: update-changelog | ||
| run: bun run update-changelog | ||
| continue-on-error: true |
There was a problem hiding this comment.
continue on error as i will use exit code
There was a problem hiding this comment.
I don't like this, I prefer not to do anything versus checking error code of previous github action steps.
There was a problem hiding this comment.
adjusted, now the publish is much simplified i think
| run: | | ||
| git config --local user.name "github-actions" | ||
| git config --local user.email "github-actions@users.noreply.github.com" | ||
| git push origin main --tags No newline at end of file |
There was a problem hiding this comment.
then push origin main as a new commit and git tagging was prev made by npm version x command
| if (version === packageVersion) { | ||
| process.exit(0); | ||
| console.log("version is already up to date, do not publish"); | ||
| process.exit(1); |
There was a problem hiding this comment.
if same version, return error / false - no need to publish or further actions in publication
| } | ||
|
|
||
| await $`npm version ${version.trim()}`; No newline at end of file | ||
| await $`npm version ${version.trim()}`; |
There was a problem hiding this comment.
else npm version x (exit code 0 is success by default)
| "lint": "bunx tsc", | ||
| "prepublishOnly": "bun changelog-updater.js" | ||
| "update-changelog": "bun changelog-updater.js", | ||
| "manualPublish": "bun run update-changelog && npm publish" |
There was a problem hiding this comment.
can still run manually with this command, instead of relying on pre publish npm hook
nojaf
left a comment
There was a problem hiding this comment.
I would prefer a single script where all these tasks are handled together.
You can easily perform actions with the gh CLI, and using the Bun shell should work nicely for that.
Publish and github release could be done if a newer version was detected.
.github/workflows/publish.yml
Outdated
| - name : update changelog | ||
| id: update-changelog | ||
| run: bun run update-changelog | ||
| continue-on-error: true |
There was a problem hiding this comment.
I don't like this, I prefer not to do anything versus checking error code of previous github action steps.
|
Shameless self-promotion but you could consider something more like https://youtu.be/t3R-GnW-r9g?si=ltRVzBC7yy_Ip7Xf Let the changelog be the driver, use |
add publish.yml gh action and publication workflow, and slightly modify manual npm publish package.json comands