-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Add handle-release-branches-workflow #16580
Conversation
Nx Cloud ReportCI ran the following commands for commit 0308885. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
steps: | ||
- if: ${{ needs.branch-checks.outputs.is-actionable-branch == 'true' && needs.latest-or-next-release-branch-check.outputs.check == 'false' }} | ||
run: | | ||
curl -X POST https://api.github.com/repos/storybookjs/frontpage/dispatches \ |
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.
This technique is from:
- https://blog.marcnuri.com/triggering-github-actions-across-different-repositories
- https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event
The frontpage
workflow would look like:
name: Respond to request-create-frontpage-branch
on: [repository_dispatch]
jobs:
build:
runs-on: ubuntu-latest
if: github.event.action == 'request-create-frontpage-branch'
steps:
- uses: actions/checkout@v2
- run: |
echo "Creating `${{ github.event.client_payload.branch }}` branch..."
git branch temp
git push -f origin temp:${{ github.event.client_payload.branch }}
curl -X POST https://api.github.com/repos/kylegach/actions-test-a/dispatches \
-H 'Accept: application/vnd.github.v3+json' \
-u ${{ secrets.ACCESS_TOKEN }} \
--data '{"event_type": "created-frontpage-branch", "client_payload": { "branch": "${{ needs.branch-checks.outputs.branch }}" }}'
Pushing the release-x-x
branch would then kick off a Netlify build for that branch, which would pull in the appropriate version's content from this repo's release-x-x
branch.
The curl
above would allow for this repo to receive a confirmation message, if desired. Otherwise, it can be removed.
364b727
to
5e95e33
Compare
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.
Should this PR be against main?
No, next
is the default branch
I think this workflow would obviate the need for the build-frontpage script. Is that correct?
If not, that script or this workflow will likely need modified to live alongside one another
Yes, I believe so
Have I done enough to safeguard this workflow? Is there a better way to alert of potentially lost changes than a failure w/ logged warning? Which steps could fail?
At any rate, since this is only copying the branch automatically, we never lose information correct? We only run the risk of some info not propagating properly
Sending the dispatch event to frontpage will require an access token. I'm unsure what that should be. Do we have a bot account for such things?
Yes we do -- DM'ing
Because the value of |
@kylegach is the frontpage side set up to read |
That's a syntax to push the local More info: https://stackoverflow.com/a/28302850 |
- Responds to event dispatched by monorepo workflow - storybookjs/storybook#16580
Realized I never answered this. 🤦♂️ To explain, I'll keep the same assumptions from the description: "latest" = |
I don't believe the failing CircleCi checks, which are both e2e tests, are related. |
- Assuming "latest" is 6.3 & "next" is 6.4... - On push to `main` - Use webhook to kick off production frontpage deploy - On push to `next` - Creates & force-pushes `release-6-4` branch - Sends dispatch event to frontpage repo to create `release-6-4` branch - On push to `release-x-x` - If pushing to `release-6-4` - Warns that changes will be lost on next push to `next` - Else - Sends dispatch event to frontpage repo to create `release-n-n` branch - Remove `build-frontpage` script - Remove references from teamcity & circleci configs
bf30421
to
0308885
Compare
Amazing job @kylegach !!! 🚀 |
- Responds to event dispatched by monorepo workflow - storybookjs/storybook#16580
Why
To trigger branch-based versioned docs builds, we need to do some branch management between this repo and
frontpage
. By automating the creation of therelease-x-x
branches (both here and infrontpage
), we can develop as usual, without having to manually ensure that therelease-x-x
branches are kept in-sync withmain
&next
(here) andmaster
(frontpage).What I did
Scenarios
On push to
main
On push to
next
release-6-4
branchrelease-6-4
branchOn push to
release-x-x
release-6-4
next
release-x-x
branchQuestions
main
?build-frontpage
script. Is that correct?frontpage
will require an access token. I'm unsure what that should be. Do we have a bot account for such things?