richardsimko/update-tag

Add `vX` tags

alexesprit opened this issue · 2 comments

I suggest to add vX tags, where X is a major version of the action. This allows to use the action safer:

uses: richardsimko/update-tag@v1

Using master reference is not recommended, as it could contain non-compatible changes.

The vX tag should point on the latest vX.x.x release (e.g. v1 -> v1.x.x).

This could be done automatically with this very action. The workflow file to update a reference to a latest release.

# update-tag.yml

name: Update version reference
on:
  release:
    types: [edited, published]
jobs:
  update-ref:
    name: Update reference
    runs-on: ubuntu-latest
    steps:
      - name: Extract major version from tag
        run: |
          FULL_VERSION=${GITHUB_REF##*/}
          MAJOR_VERSION=$(echo "${FULL_VERSION%.*.*}")
          echo "::set-env name=TAG_NAME::${MAJOR_VERSION}"
      - name: Update reference to latest version
        uses: ./
        with:
          tag_name: ${{ env.TAG_NAME }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

This way is recommended in the documentation: https://github.com/actions/toolkit/blob/master/docs/action-versioning.md.

The released versions are available as tags, so you can pin the version you want to use: https://github.com/richardsimko/update-tag/releases

Currently the release workflow is very manual as I haven't gotten around to automating it since the effort required was a lot higher than simply releasing it manually. This is a very simple workflow so I don't foresee it needing many updates in the future unless the GitHub API changes.

I could give your suggested workflow a try!

The latest version is now available as richardsimko/update-tag@v1 and richardsimko/update-tag@v1.0.3

Thanks for the suggestion!