Trigger action on registry_package published

I want to trigger a “Deploy” action whenever my app’s Docker image is pushed to my Gitea installation via some other action (or manual push to Docker registry - managed as “Packages” in the same Gitea instance).

I can’t seem to get Gitea’s trigger event “registry_package” of type “published” to work.

Snippets from my YAML file:

# this will NOT be triggered
name: Deploy
      - published

# this will be triggered on push, and I am able to pull the Docker image for deployment
name: Deploy

Current setup:

  • Gitea v1.21.11.
  • The Gitea action si in a private repo, in a private org.
  • I have a “Build” Gitea action that runs on push. It is working, and as part of this action, it push my app’s Docker image to my Gitea Docker registry.
  • Confirmed the docker image is pushed to my Gitea as It is viewable in the organisation’s “Packages” tab.
  • I did not “Link this package to a repository”.

Q1: How to get “registry_package” to work?

Q2: If Q1 can be solved, how to run only if the deployed package name matches? (I saw some Github action examples using if: ${{ == 'my-app/my-app-test' }}). A working Gitea action to demonstrate this use case would be awesome…or at least pointers to figure this out.

Thanks for reading and hope to get some help on this.

For those trying to achieve similar things, this is my current findings:

  • Action event registry_package will only trigger when the package (the published Docker container in my case) is linked to the repository (via the “Link this package to a repository” feature).

Thinking about this, it does make sense because we probably don’t want our actions to get triggered every time a package is published (i.e. by other repositories). This means we don’t need to filter (conditional run) the action based on the ${{}} if we only have 1 package for the repo.