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

Ensure release asset is attached properly to the release #870

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

dkotter
Copy link
Collaborator

@dkotter dkotter commented Mar 12, 2025

Description of the Change

We've had a long-standing issue where our GitHub Workflow that is supposed to build a final release asset and attach that to a published release has not been working (in fact, it doesn't run at all). We've attempted to fix this a few times but nothing has worked. Did another dive today and I think I've figured out the problem:

  • When we do a release, we open a release PR against develop
  • This is merged in and then we merge develop into trunk
  • We have a GitHub Workflow that fires on merges to trunk that will build the code and push that to our stable branch
  • We then publish a release on GitHub and we target the stable branch for that release
  • At this point, we'd expect our release Workflow to fire (as it is supposed to fire on release publish) but it doesn't

I believe the issue here is that when we build the code to push to the stable branch, we remove any files that we don't want in the final release, based on our .gitattributes file. This will include removing the .github/workflows directory. So when the release is published, the stable branch won't contain any of those workflow files and thus the workflow won't ever run.

I compared this to how we do things on Distributor and I do see the .github/workflows directory and .gitattributes file in the stable branch, whereas we don't see that in this repo.

So this PR attempts to fix things by adding the .github/workflows directory and .gitattributes file into the code we push to the stable branch. When the release workflow runs, it should remove those when it runs npm run archive, so the release that gets attached shouldn't have those files.

In addition, to ensure those files don't end up in the release we send people when they sign up (or any updates we push out to them), we've changed our updater to pull the release asset, which matches what we do on Distributor.

How to test the Change

Not a great way to test this until we push out a new release. You can run all the release commands locally and ensure those work as expected:

npm install
npm run build
npm run makepot
composer install --no-dev -o
npm run archive
mkdir -p release/.github/workflows && cp -rf .github/workflows/ release/.github/workflows && cp .gitattributes release

Changelog Entry

Changed - Use the attached release asset in our plugin updater
Fixed - Ensure the final release asset gets attached properly to the release

Credits

Props @dkotter

Checklist:

@dkotter dkotter added this to the 3.4.0 milestone Mar 12, 2025
@dkotter dkotter self-assigned this Mar 12, 2025
@dkotter dkotter requested review from jeffpaul and a team as code owners March 12, 2025 16:01
@github-actions github-actions bot added the needs:code-review This requires code review. label Mar 12, 2025
@jeffpaul
Copy link
Member

OH HELL YES, thanks for tackling this one! I'm fine with us shipping a quick minor at some point to test this (so that the next major includes the release ZIP).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
Status: Code Review
Development

Successfully merging this pull request may close these issues.

2 participants