diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59f820c..f6439b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: matrix: platform: [ubuntu-latest, macos-latest, windows-latest] env: + PREFIX: 'ci-v' TEST_TAG: 'ci-v1.2.3' TEST_TAG_PREREL: 'ci-v2.3.4-prerelease' TAG_MAJOR: 'ci-v1' @@ -46,21 +47,21 @@ jobs: - name: 'TEST: Update Major' uses: ./. with: - tag: ${{ env.TEST_TAG }} - prefix: 'ci-v' + tag: "refs/tags/${{ env.TEST_TAG }}" + prefix: ${{ env.PREFIX }} - name: 'TEST: Update Minor' uses: ./. with: - tag: ${{ env.TEST_TAG }} - prefix: 'ci-v' + tag: "refs/tags/${{ env.TEST_TAG }}" + prefix: ${{ env.PREFIX }} update-minor: true - name: 'TEST: Ignore Prerelease' uses: ./. with: - tag: ${{ env.TEST_TAG_PREREL }} - prefix: 'ci-v' + tag: "refs/tags/${{ env.TEST_TAG_PREREL }}" + prefix: ${{ env.PREFIX }} - name: Cleanup if: always() diff --git a/action.yml b/action.yml index 7bf6c23..1627790 100644 --- a/action.yml +++ b/action.yml @@ -45,20 +45,24 @@ runs: INPUT_TAG: ${{ inputs.tag }} INPUT_PREFIX: ${{ inputs.prefix }} run: | - version=$INPUT_TAG + version="$INPUT_TAG" if [[ -z "$version" ]]; then - version=$GITHUB_REF + version="$GITHUB_REF" fi + echo "Target tag name or reference: '$version'" + version="${version#refs/}" version="${version#tags/}" version="${version#$INPUT_PREFIX}" + echo "Target version: '$version'" + semvertool="$GITHUB_ACTION_PATH/semver-tool/semver.sh" status=$("$semvertool" validate "$version") if [[ "$status" != "valid" ]]; then - echo ::error ::Version $version does not match the semver scheme 'X.Y.Z(-PRERELEASE)(+BUILD)' + echo "::error ::Version '$version' does not match the semver scheme 'X.Y.Z(-PRERELEASE)(+BUILD)'" exit 1 fi