Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ jobs:
run: |
git restore .
git checkout master
git fetch --all
git pull origin master
git fetch --all git pull origin master

git checkout develop
git restore .
Expand All @@ -103,3 +102,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: snapshot release
if: ${{ steps.changesets.outputs.published == 'false' }}
run: |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an output of the above changesets action.

So the thought process here is

-if we dont release, we can release a snapshot

  • so we checkout the develop branch (currently)

  • then run changeset version passing snapshot we can name a snapshot by passing the name to it (in this case i called it snapshot).

  • then call pnpm publish -r ... -r causes pnpm to create the topological graph of the packages so it should be in order

  • tag is passed and called snapshot for sanity and so we arent overwriting latest in any registry

  • no-git-checks is a pnpm feature so that if we have git files uncommitted it will commit.

Questions I am unsure of with this flow:

If there is no changeset, i'd imagine it wouldn't publish. I say this because if i run the following locally i would get this

pnpm changeset version --snapshot snapshot                                                                                                                                                                                                                                                             ✔  7749  16:31:50

> forgerock-javascript-sdk@ changeset /Users/ryan.basmajian/programming/forgerock-javascript-sdk
> changeset "version" "--snapshot" "snapshot"

🦋  warn No unreleased changesets found, exiting.

So it exits, but i'm not really sure about the next step. it feels like maybe we would want a more sophisticated script written in JS that says if we get a process exit here or if we get that text output, then we just exist the script.

Thoughts?

git checkout develop
pnpm changeset version --snapshot snapshot
pnpm publish -r --tag snapshot --no-git-checks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOME: ${{ github.workspace }}
NPM_CONFIG_PROVENANCE: 'false'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"clean": "shx rm -rf ./{coverage,dist,docs,node_modules,tmp}/ ./{packages,e2e}/*/{dist,node_modules}/ && git clean -fX -e \"!.env*,nx-cloud.env\"",
"ci:release": "pnpm publish -r --no-git-checks && changeset tag",
"ci:version": "changeset version && pnpm install --no-frozen-lockfile",
"changeset": "pnpm changeset",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing recursion of the changeset command 🤦

"changeset": "changeset",
"commit": "git cz",
"docs": "nx affected --target=typedoc",
"e2e": "CI=true nx affected:e2e",
Expand Down
Loading