Badges for latest tag

Use case: I have two workflows, one which deploys to dev on push to master, and another which deploys to prod on semver tag v?[0-9]+.[0-9]+.[0-9]+.

I want to show a badge with the workflow status for the prod deploy. However, it never updates, because the workflow is not “on” the master branch, even though the sha the tag points to is. Setting branch=tag works, but isn’t dynamic: e.g. https://github.com/org/repo/actions/workflows/prod.yaml/badge.svg?branch=v0.0.1

I create the tag by making a github release. Perhaps I should just change my action on? But not sure what to use instead:

currently:

on:
  push:
    tags:
      - v?[0-9]+.[0-9]+.[0-9]+

name: deploy prod

TL;DR: need badge for action triggered by semver release

Whether this works probably depends on where you want to use the “latest tag” badge, but how about using Actions to update the URL? Something like this: When a new tag is pushed, check if the version number is higher than the one in the currently deployed URL. If it is, update the URL. Probably best to do it in a job that runs only after successful deployment.