diff --git a/.github/workflows/tag-pkg.yml b/.github/workflows/tag-pkg.yml new file mode 100644 index 0000000000..8eaf266109 --- /dev/null +++ b/.github/workflows/tag-pkg.yml @@ -0,0 +1,37 @@ +name: Tag pkg + +on: + workflow_dispatch: + inputs: + version: + description: "pkg version to tag (e.g. v1.2.2)" + required: true + type: string + +permissions: + contents: write + +jobs: + tag: + name: Create pkg tag + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: develop + fetch-depth: 0 + + - name: Create and push pkg tag + run: | + VERSION="${{ inputs.version }}" + if ! [[ "$VERSION" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then + echo "Error: version '$VERSION' does not match semver format (e.g. v1.2.2)" + exit 1 + fi + TAG="pkg/$VERSION" + if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "Error: tag '$TAG' already exists" + exit 1 + fi + git tag "$TAG" + git push origin "$TAG"