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

docs: Add to example how to automatically release all packages #16

Merged
merged 3 commits into from
Oct 7, 2024

Conversation

spydon
Copy link
Member

@spydon spydon commented Sep 20, 2024

Fixes: #19

@spydon spydon requested a review from Gustl22 September 20, 2024 15:41
@Gustl22
Copy link
Collaborator

Gustl22 commented Sep 20, 2024

Did you successfully run that workflow? I think I tried that already and it fails, as the original workflow is not triggered by a push of a git tag or not by a workflow dispatch event. Calling another workflow is not considered as workflow dispatch. So one always needs two steps, and manually need to dispatch the publishing.

@spydon
Copy link
Member Author

spydon commented Sep 20, 2024

Did you successfully run that workflow? I think I tried that already and it fails, as the original workflow is not triggered by a push of a git tag or not by a workflow dispatch event. Calling another workflow is not considered as workflow dispatch. So one always needs two steps, and manually need to dispatch the publishing.

I'll try, but it should be possible. See the first paragraph of the docs here:

When you use the repository's GITHUB_TOKEN to perform tasks, events triggered by the GITHUB_TOKEN, with the exception of workflow_dispatch and repository_dispatch, will not create a new workflow run.

https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#triggering-a-workflow-from-a-workflow

@Gustl22
Copy link
Collaborator

Gustl22 commented Sep 20, 2024

The release-publish.yml will run, but it will not be accepted by pub, as it is not a tag push event, or a tag workflow dispatch event. I think its still considered as branch push event.

@spydon
Copy link
Member Author

spydon commented Sep 20, 2024

The release-publish.yml will run, but it will not be accepted by pub, as it is not a tag push event, or a tag workflow dispatch event. I think its still considered as branch push event.

A certain person nagged them until they added support for just that 😉
image

@Gustl22
Copy link
Collaborator

Gustl22 commented Sep 20, 2024

Isn't the push check box just meant for refType tag and not for branch? I would be more than happy if it would work.

@spydon
Copy link
Member Author

spydon commented Oct 7, 2024

@Gustl22 it works!

Just tested on here: https://github.com/spydon/melos-action-test
Flow:

  • Press run workflow for "release-prepare.yml"
  • That opens a PR that needs to be reviewed
  • PR is merged and "release-tag.yml" automatically starts
  • "release-tag.yml" tags all packages and dispatches one "release-publish.yml" job per tag (on that ref)
  • Each "release-publish.yml" job releases its corresponding package

Not sure if we might run into some race conditions though, we'll see.

@Gustl22
Copy link
Collaborator

Gustl22 commented Oct 7, 2024

That's genius. So actually it's a workflow_dispatch tag event, but triggered by the GH bot (I suspect?).
I didn't realize, that the workflow trigger state is not propagated with use of gh workflow run in contrast to a direct workflow_call. I suspect this is not really wanted by GH (as of possibilty of circular workflows), but it works 🎉
Thank you so much!

P.s. also didn't know, we had a test repository just for our melos action. That's awesome!

@spydon spydon merged commit be64ed7 into main Oct 7, 2024
@Gustl22 Gustl22 deleted the docs/automatic-release branch October 7, 2024 14:38
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.

release-prepare.yaml generates incorrect changelog
2 participants