-
-
Notifications
You must be signed in to change notification settings - Fork 534
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
+101
−15
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0ddb716
chore: add lock-closed-issues workflow
kettanaito f14bab5
chore: add release-preview workflow
kettanaito 154c6e2
chore: update actions versions in workflows
kettanaito 14aa5b9
chore: use "--comment=update" for package previews
kettanaito dff3ec4
docs: add preview publish to decisions log
kettanaito 87e711a
chore: add permission check for the reviewer
kettanaito 50edf37
chore: use `actions-cool/check-user-permission` for permissions check
kettanaito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
name: auto | ||
|
||
on: [push] | ||
|
||
jobs: | ||
cancel-previous-workflows: | ||
runs-on: macos-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: locked-closed-issues | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
permissions: | ||
issues: write | ||
|
||
jobs: | ||
action: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: dessant/lock-threads@v5 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-inactive-days: '14' | ||
issue-lock-reason: '' | ||
process-only: 'issues' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: release | ||
|
||
on: | ||
pull_request_review: | ||
types: [submitted] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check: | ||
# Trigger the permissions check whenever someone approves a pull request. | ||
# They must have the write permissions to the repo in order to | ||
# trigger preview package publishing. | ||
if: github.event.review.state == 'approved' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
has-permissions: ${{ steps.checkPermissions.outputs.require-result }} | ||
steps: | ||
- name: Check permissions | ||
id: checkPermissions | ||
uses: actions-cool/check-user-permission@v2 | ||
with: | ||
require: 'write' | ||
|
||
preview: | ||
# The approving user must pass the permissions check | ||
# to trigger the preview publish. | ||
needs: check | ||
if: needs.check.outputs.has-permissions == 'true' | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Set up pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 8.15.6 | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Install Playwright browsers | ||
run: pnpm exec playwright install | ||
|
||
- name: Lint | ||
run: pnpm lint | ||
|
||
- name: Build | ||
run: pnpm build | ||
|
||
- name: Tests | ||
run: pnpm test | ||
|
||
- name: Publish preview | ||
run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm --comment=update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:
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;needs
the check job BUT also needs a customif
condition since the check job won't ever fail (even if it's skipped, GitHub still treats the job status assuccess
). In theif
, the preview job can check the sharedoutputs
from the permissions check, and publish the preview only if the output is'true'
.