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

Fix tag release workflow #690

Merged
merged 6 commits into from
Apr 18, 2024
Merged

Conversation

constanca-m
Copy link
Contributor

@constanca-m constanca-m commented Apr 18, 2024

What does this PR do?

The current release workflow was failing with:

Run actions/github-script@v7
SyntaxError: Unexpected number
    at new AsyncFunction (<anonymous>)
Error: Unhandled error: SyntaxError: Unexpected number
    at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35424:16)
    at main (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35522:26)
    at /home/runner/work/_actions/actions/github-script/v7/dist/index.js:35497:1
    at /home/runner/work/_actions/actions/github-script/v7/dist/index.js:35553:3
    at Object.<anonymous> (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35556:12)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)

Putting the version variable inside " to make it a string solves this issue.

We also check if the version variable in version.py increased. If that is the case, then we create a new release. Otherwise, nothing happens.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.md

How to test

As far as I am aware, the only way to test would be by using your own repository. Just do the following:

  • Have a share/version.py file there.
  • Copy the release workflow to that repository.

Then make the commits to check everything is working as expected. You need to update the version.py file to trigger the workflow, unless you also change the trigger or make the workflow run manually.

It is not possible to test it here, because we would have to update the version.py file of ESF, which does not make sense in this case.

Signed-off-by: constanca <[email protected]>
gizas
gizas previously approved these changes Apr 18, 2024
axw
axw previously approved these changes Apr 18, 2024
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

LGTM. I'm wondering if we should make the tagging a workflow_dispatch workflow that one needs to explicitly run. Then we could update the version ahead of the release, and it would be present in pre-release builds and smoke tests. Doesn't need to be addressed in this PR.

@constanca-m constanca-m dismissed stale reviews from axw and gizas via c008014 April 18, 2024 08:34
@constanca-m
Copy link
Contributor Author

I updated the workflow to only release a new tag if the new version in version.py is bigger than the latest released version. This way, if there was no change to the variable version in version.py, we also do not release a new tag, or if the version decreased somehow, we do not release it as well. @axw @gizas, is it better this way?

Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Looks good!

@constanca-m constanca-m merged commit 374e966 into elastic:main Apr 18, 2024
4 checks passed
@constanca-m constanca-m deleted the fix-release-workflow branch April 18, 2024 09:12
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.

3 participants