DEV Community

Cover image for Automatically update git major tags on GitHub marketplace release

Automatically update git major tags on GitHub marketplace release

Motivation

Having previously dockerized our semantic release configuration in @open-sauced/semantic-release-conventional-config, a manual step was needed to publish the action in the GitHub marketplace.

This meant that forcing a major tag update with @semantic-release/exec as part of the release process was possible, but would result in the major tag (for example v3) linking to a valid repository commit SHA that is not actually released in the marketplace.

Sensibly solving these issues required:

  • keeping the semantic release configuration intact
  • testing the action container in another repository
  • having a maintainer manually edit and save the release
  • letting the marketplace.yml workflow update major tags in the curated release context

It may sound tedious but in practice, all a maintainer has to do to update the marketplace tags is edit a published release and press the save button. That's exactly 2 clicks from the repository front page and the simplest way to have acceptance testing.

My Workflow

name: "Action major version tag"

on:
  release:
    types:
      - published
      - edited

jobs:
  latest:
    name: Update action tags
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.ref }}

      - name: "🚀 publish action"
        uses: Actions-R-Us/actions-tagger@v2
        with:
          publish_latest_tag: false
          prefer_branch_releases: false
Enter fullscreen mode Exit fullscreen mode

The full workflow is available here: .github/workflows/marketplace.yml

Submission Category: Maintainer Must-Haves

Yaml File or Link to Code

Live repository using this workflow:

GitHub logo open-sauced / semantic-release-conventional-config

semantic-release shareable config to publish to npm and/or ghcr

This project has been archived in favor of open-sauced/release

Open Sauced

@open-sauced/semantic-release-conventional-config

semantic-release shareable config to publish to npm and/or ghcr.

now available as a GitHub Marketplace action

Commits Issues Releases Discord Twitter

📦 Plugins

This shareable configuration use the following plugins:

🖥️ Requirements

Most important limitations are:

  • GITHUB_TOKEN for everything
  • NPM_TOKEN for public npm library
  • docker containers need to be built beforehand

You can skip here if you are using elevated Private Access Token, however we don't recommend going down that path.

No force push or admin cherries branch protections for the following branches:

  • main - required
  • next - optional, next channel
  • next-major - optional, next major
  • alpha - optional, pre-release branch
  • beta - optional, pre-release branch
  • vX[.X.X] - maintenance releases

If you use more than the main branch, optionally create an environment that is limiting where pushes can come from…




Additional Resources / Info

Here are all the open source actions we are using to power this release workflow:

Be sure to include the DEV usernames of your collaborators:

Top comments (0)