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

Add tagging action #298

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Add tagging action #298

merged 1 commit into from
Apr 3, 2024

Conversation

nb1701
Copy link
Contributor

@nb1701 nb1701 commented Apr 2, 2024

Adds an action to tag the repo. Partially addresses civiform/civiform#4763

@nb1701 nb1701 force-pushed the nb1701/add_tagging_action branch 3 times, most recently from f37b647 to 9b83e41 Compare April 2, 2024 22:07
@nb1701
Copy link
Contributor Author

nb1701 commented Apr 2, 2024

I tested this with some gh shenanigans and it seems to work. Soon, the "Create Release" action on the civiform repo will trigger this action with the given release version. Then, we'll be able to have people use the specific tag on this repo that matches the tag of the release they are trying to deploy.

Copy link
Contributor

@gwendolyngoetz gwendolyngoetz left a comment

Choose a reason for hiding this comment

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

When we get to running this on the release call in civiform/civiform do we want to prevent this from manually being run in order to prevent them from getting out of sync?

run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git tag -a ${{ github.event.inputs.release_number }} -m "Release ${{ github.event.inputs.release_number }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
git tag -a ${{ github.event.inputs.release_number }} -m "Release ${{ github.event.inputs.release_number }}"
git tag ${{ github.event.inputs.release_number }} --message="Release ${{ github.event.inputs.release_number }}"

I had to look up the -a since I hadn't used it. I'd remove it unless you found a reason it needs to be explicitly set. The docs say:

If -m or -F is given and -a, -s, and -u are absent, -a is implied.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The -a is the actual tag, and the -m is a message for the tag. I have it slightly different here, but I guess it doesn't need to be so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would seem git tag -m doesn't really work on its own, despite what it says here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, it's git tag <tag> -m <whatever>. I think I'll just remove the -m and -a entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, we still want the -m or else it just fills it in with the commit message of the commit it's tagged on.

@nb1701
Copy link
Contributor Author

nb1701 commented Apr 2, 2024

When we get to running this on the release call in civiform/civiform do we want to prevent this from manually being run in order to prevent them from getting out of sync?

Is that a thing we can do? Might still be nice to have the option to run it manually in case things go sideways, but I don't know. It's pretty easy to delete a bad tag if we need to.

@nb1701 nb1701 force-pushed the nb1701/add_tagging_action branch 2 times, most recently from 7548556 to 1d1838d Compare April 2, 2024 22:38
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git tag ${{ github.event.inputs.version }} -m "${{ github.event.inputs.version }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
git tag ${{ github.event.inputs.version }} -m "${{ github.event.inputs.version }}"
git tag ${{ github.event.inputs.version }} --message="${{ github.event.inputs.version }}"

Using the full arg name make it easier to understand at a glance.

@gwendolyngoetz
Copy link
Contributor

When we get to running this on the release call in civiform/civiform do we want to prevent this from manually being run in order to prevent them from getting out of sync?

Is that a thing we can do? Might still be nice to have the option to run it manually in case things go sideways, but I don't know. It's pretty easy to delete a bad tag if we need to.

I thought there was a trigger type that let use trigger it, but not in the ui. I might be remembering wrong.

@nb1701
Copy link
Contributor Author

nb1701 commented Apr 2, 2024

Ah yeah, there's https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_call, but I'm not sure if that works cross-repo. https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch might also work. I'll take a look at those when I work on the civiform release action trigger.

@nb1701 nb1701 merged commit 6d6488a into main Apr 3, 2024
5 checks passed
@nb1701 nb1701 deleted the nb1701/add_tagging_action branch April 3, 2024 16:57
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