Skip to content

ci: run CICD workflow on tag creation #5971

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

Merged
merged 1 commit into from
Feb 12, 2024
Merged

ci: run CICD workflow on tag creation #5971

merged 1 commit into from
Feb 12, 2024

Conversation

malt3
Copy link
Contributor

@malt3 malt3 commented Feb 12, 2024

Fixes 4d2bdf4. For a release to be triggered, the workflow has to run with GITHUB_REF=refs/tags/X.Y.Z, which was disabled by limiting the push trigger to a branch.
Please note that the tag filter v*.*.* does not work since releases are tagged like 0.0.24.
This will create extra runs in case branches are created in the uutls/coreutils repo.
I think this is an acceptable tradeoff.

See also:

@tertsdiepraam
Copy link
Member

Great! However, it should be narrowed to tags only. Looking at the docs you linked I think something like this should be used

on:
  push:
    tags:
      - v*.*.*

But there's also the release event, which might be even better: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release

@malt3
Copy link
Contributor Author

malt3 commented Feb 12, 2024

Great! However, it should be narrowed to tags only. Looking at the docs you linked I think something like this should be used

on:
  push:
    tags:
      - v*.*.*

This would prevent the workflow from running on pushes to main (after a PR is merged).
The push trigger also requires all conditions to be true. Combining a branch filter with a tag filter is not satusfyable.

I think the release event is triggered when publishing a release (not a tag).
The CICD workflow triggers the draft release so this is not possible either.

@tertsdiepraam
Copy link
Member

tertsdiepraam commented Feb 12, 2024

This would prevent the workflow from running on pushes to main (after a PR is merged).
The push trigger also requires all conditions to be true. Combining a branch filter with a tag filter is not satusfyable.

Maybe we can do:

on:
  push:
    tags:
      - v*.*.*
  push:
    branches:
      - main

I don't see any examples of that in the docs but also nothing that says that's not possible? This particular example might not be valid yaml, but something like it should be possible right?

I think the release event is triggered when publishing a release (not a tag).
The CICD workflow triggers the pre-release so this is not possible either.

I don't understand this part. Can't we just make a release that will trigger the CI?

@piotrkwiecinski
Copy link
Contributor

This should be:

on:
  push:
    tags:
      - v*.*.*
    branches:
      - main

To support push on both branches and tags

@malt3
Copy link
Contributor Author

malt3 commented Feb 12, 2024

Understanding the docs correctly is really hard. After reading them again, I agree with @piotrkwiecinski.

This is also shown in the example here: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-branches-and-tags

Adding two separate push triggers as suggested by @tertsdiepraam does not work, since this a JSON/YAML object and would result in duplicate keys.

Can't we just make a release that will trigger the CI?

Currently, the release engineer pushes the tag, that triggers the workflow, the workflow creates a draft release.
I'm not sure how the workflow should upload release artifacts if the release must already exist.

Fixes 4d2bdf4. For a release to be triggered, the workflow has
to run with GITHUB_REF=refs/tags/X.Y.Z, which was disabled by
limiting the push trigger to a branch.
@tertsdiepraam
Copy link
Member

Understanding the docs correctly is really hard.

Yeah, they aren't great :(

Currently, the release engineer pushes the tag, that triggers the workflow, the workflow creates a draft release.
I'm not sure how the workflow should upload release artifacts if the release must already exist.

We have can create a release in the GitHub UI. I was thinking that could trigger the CI for and attach the artifacts to the release, but I'm happy with the current version if it works.

Copy link
Member

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

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

It's at least worth it to test this :)

@cakebaker cakebaker merged commit f07df8a into uutils:main Feb 12, 2024
@cakebaker
Copy link
Contributor

Thanks everyone :)

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.

4 participants