elastic / elastic-serverless-forwarder

Elastic Serverless Forwarder
Other
35 stars 36 forks source link

Fix tag release workflow #690

Closed constanca-m closed 5 months ago

constanca-m commented 5 months ago

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

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:

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.

constanca-m commented 5 months ago

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?