Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: publish preview versions #2335

Merged
merged 7 commits into from
Oct 27, 2024
Merged

chore: publish preview versions #2335

merged 7 commits into from
Oct 27, 2024

Conversation

kettanaito
Copy link
Member

yannbf
yannbf previously approved these changes Oct 27, 2024
yannbf
yannbf previously approved these changes Oct 27, 2024
Copy link

pkg-pr-new bot commented Oct 27, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/msw@2335

commit: 50edf37

yannbf
yannbf previously approved these changes Oct 27, 2024
# trigger preview package publishing.
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
outputs:
Copy link
Member Author

Choose a reason for hiding this comment

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

Setup

The trick to a finally properly working setup was:

  • Has 2 separate jobs: one checks for permissions, the other publishes the preview;
  • The check job shares its outputs via outputs. It references the used action output based on the user's permissions. The job itself never fails because then the entire PR status will be failed, which isn't nice;
  • The preview job needs the check job BUT also needs a custom if condition since the check job won't ever fail (even if it's skipped, GitHub still treats the job status as success). In the if, the preview job can check the shared outputs from the permissions check, and publish the preview only if the output is 'true'.

@kettanaito kettanaito merged commit 64d02b7 into main Oct 27, 2024
18 checks passed
@kettanaito kettanaito deleted the chore/package-previews branch October 27, 2024 14:11
@kettanaito
Copy link
Member Author

Released: v2.6.0 🎉

This has been released in v2.6.0!

Make sure to always update to the latest version (npm i msw@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants