DEV Community

Cover image for Automate repository tagging with GitHub Actions
Brian Hill for Daily

Posted on

Automate repository tagging with GitHub Actions

At Daily, we build video chat APIs to streamline adding video chat to any app or website. Developers are building a lot more with video these days, so we've been adding new API features (and growing our team!) to meet the demand. Thatโ€™s meant many more pull requests.

We use a monorepo to manage source code for most of our applications. As we faced the challenge of maintaining our changelog, we understood
that knowing what's changed in production wouldn't be as simple as comparing two commits in our monorepo, because we don't deploy every application with every commit.

To help us understand what's changed, and which changes have been deployed to an environment, we developed
a convention for tags we apply in our GitHub:

Convention: [app-name]-[YYYY-mm-dd]-[environment]
Example: web-server-2020-07-01-production
Enter fullscreen mode Exit fullscreen mode

While we agreed on a tagging convention for our repositories, asking everyone to manually update those tags was unsustainable.

Enter our hero, GitHub actions!

Avengers in Captain America Marvel movie

Like any of your favorite action movie heroes, GitHub actions respond to a triggering event and save the day, errr, the developer from having to do a bunch of manual work. We use GitHub actions to automatically update our repository tags.

Our workflow

The create-tag-action creates GitHub tags after the deployment of an application according to our convention. If the desired tag already exists, the commit with which the tag is associated is changed to the current commit being used in the workflow.

Our yaml file

Have a look at our repository to get the full picture of how this works.

Submission category

DIY Deployments

Additional resources

Our daily-demos open source repository makes use of this action. We hope that more projects try it out soon too, and that this overview was helpful. If you have any questions, please donโ€™t hesitate to reach out.

Oldest comments (0)