diff --git a/.gitea/workflows/update-major-tag.yaml b/.gitea/workflows/update-major-tag.yaml new file mode 100644 index 0000000..4ab7711 --- /dev/null +++ b/.gitea/workflows/update-major-tag.yaml @@ -0,0 +1,37 @@ +name: Update major version tag + +on: + push: + tags: + - "v*.*.*" + +permissions: + contents: write + +jobs: + update-major-tag: + runs-on: ubuntu-latest + steps: + - name: Check out release tag + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 + with: + fetch-depth: 0 + + - name: Update floating major tag + shell: bash + env: + RELEASE_REF: ${{ gitea.ref }} + run: | + set -euo pipefail + + release_tag="${RELEASE_REF#refs/tags/}" + if [[ ! "$release_tag" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then + echo "Refusing to update a major tag from invalid release tag: $release_tag" >&2 + exit 1 + fi + + major_tag="v${BASH_REMATCH[1]}" + git config user.name "Gitea Actions" + git config user.email "actions@localhost" + git tag --force --annotate "$major_tag" --message "Update $major_tag to $release_tag" "$release_tag" + git push origin "refs/tags/$major_tag" --force diff --git a/README.md b/README.md index ae40c63..a0ca701 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,17 @@ Gitea may suppress workflows caused by pushes authenticated with its built-in `G The action does not force-push, create tags, publish releases, or call forge APIs. Concurrent release jobs are resolved safely by the remote rejecting a non-fast-forward push. Configure workflow-level concurrency if release PRs can overlap. +## Releasing the action + +Create and push an immutable semantic-version tag: + +```bash +git tag -a v1.1.0 -m "Release v1.1.0" +git push origin v1.1.0 +``` + +The `Update major version tag` Gitea workflow validates the release tag and automatically moves the corresponding floating major tag (for example, `v1`) to the same commit. Consumers can continue using `Nurinda/bump-erp-app-version@v1` to receive compatible v1 releases. + ## Development Run the integration test: