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(ci): add release-please for release-automation #1195

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zerok
Copy link
Contributor

@zerok zerok commented Oct 9, 2024

This will make the release process easier to manage by providing an auto-updated PR with a changelog. Since release-please only manipulates the changelog and creates a GitHub release, this PR also updates the release workflow to build binaries and attach them to the newly created release.

@zerok zerok requested a review from a team as a code owner October 9, 2024 10:06
@zerok zerok changed the title chore(ci): Add release-please for release-automation chore(ci): add release-please for release-automation Oct 9, 2024
@zerok zerok marked this pull request as draft October 9, 2024 12:23
Copy link
Member

@iainlane iainlane left a comment

Choose a reason for hiding this comment

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

As this is similar / based on what we did for wait-for-github, suggest adding ready_for_review to the types. This is because we're using the Actions bot when pushing to the PRs and so it doesn't trigger workflows. Undrafting is the trigger we use to make the release PR actually mergeable.

Are you planning to enable the merge queue? If so, you might as well add merge_group to the relevant workflows now.

@zerok
Copy link
Contributor Author

zerok commented Oct 10, 2024

As this is similar / based on what we did for wait-for-github, suggest adding ready_for_review to the types. This is because we're using the Actions bot when pushing to the PRs and so it doesn't trigger workflows. Undrafting is the trigger we use to make the release PR actually mergeable.

Are you planning to enable the merge queue? If so, you might as well add merge_group to the relevant workflows now.

For now I've create a custom app for this. I just need to transfer it into the correct account and install it here (done) :)

@zerok zerok force-pushed the zerok/release-please branch 2 times, most recently from 4b5e425 to b3d24e6 Compare October 10, 2024 11:04
@zerok zerok marked this pull request as ready for review October 10, 2024 11:09
@iainlane
Copy link
Member

iainlane commented Oct 10, 2024

This doesn't seem like a scalable approach, requiring every repository to have an app to be released using release-please. Also it adds a lot of effort into the process. What is your wider plan?

@zerok
Copy link
Contributor Author

zerok commented Oct 10, 2024

This doesn't seem like a scalable approach, requiring every repository to have an app to be released using release-please. Also it adds a lot of effort into the process. What is your wider plan?

An alternative would also to create a single automation app that we use for all all the OSS repos. My assumption right now is, that we will have more workflows that should be triggered by other workflow actions and so a custom token would be favourable here.

@iainlane
Copy link
Member

Can you just quickly say what's wrong with what we're doing in wait-for-github, which doesn't require an app?

@zerok
Copy link
Contributor Author

zerok commented Oct 10, 2024

Can you just quickly say what's wrong with what we're doing in wait-for-github, which doesn't require an app?

The requirements are slightly different. wait-for-github does not need to run a workflow right after something was done by release-please. For Tanka we also need to generate binary files and attach them to the GitHub release. Since release-please is running at the default GitHub Actions user, that follow-up workflow won't get triggered.

Your change to use ready_for_review works if you need workflows to get triggered for the release PRs. For Tanka I don't really care about that PR but for the GitHub release that is created afterwards 🙂 Or am I just overlooking something in the wait-for-github implementation? 🙂

@iainlane
Copy link
Member

Ah no, we don't react to the release event in that repo.

One thing you could do is look at the release_created and/or upload_url output. Assuming that works it should be possible to push the assets from the same workflow that creates the release, using softprops/action-gh-release or something like it.

@zerok
Copy link
Contributor Author

zerok commented Nov 13, 2024

@iainlane I've merged the two workflows no so that no special token is required. I've tested the outcome on https://github.com/zerok/tanka/releases/tag/v0.29.0 (ignore the wrong version 🤣 )

Copy link
Member

@iainlane iainlane left a comment

Choose a reason for hiding this comment

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

Looks great, let's give it a go!

const fs = require('node:fs/promises');

const releaseId = '${{ steps.lookup-release.outputs.release_id }}';
const globber = await glob.create('dist/*');
Copy link
Member

Choose a reason for hiding this comment

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

this is already in the context I guess? asking because I don't see an import for it

script: |
const currentTag = "${{ needs.release-please.outputs.release_tag }}";
core.info(`Looking for release associated with '${currentTag}'`);
const release = await github.rest.repos.getReleaseByTag({owner: context.repo.owner, repo: context.repo.repo, tag: currentTag});
Copy link
Member

Choose a reason for hiding this comment

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

nit: some newlines/indentation would be good for this one

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.

2 participants