diff --git a/.github/actions/semantic-tag-increment/action.yaml b/.github/actions/semantic-tag-increment/action.yaml index 2cdd702..5e7f50d 100644 --- a/.github/actions/semantic-tag-increment/action.yaml +++ b/.github/actions/semantic-tag-increment/action.yaml @@ -53,14 +53,13 @@ runs: echo "Increment type: $TYPE" if [[ "$TAG" == v* ]]; then - echo "Converting tag to purely numeric equivalent" TAG="${TAG:1}" fi # Regular expression to match semantic tag PATTERN="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$" - # Validate supplied tag + # Validate supplied (and parsed) tag if ! [[ "$TAG" =~ $PATTERN ]]; then echo "Invalid semantic tag"; exit 1 else @@ -71,10 +70,7 @@ runs: MAJOR=$(echo "$TAG" | sed -e "s#$REGEX#\1#") MINOR=$(echo "$TAG" | sed -e "s#$REGEX#\2#") PATCH=$(echo "$TAG" | sed -e "s#$REGEX#\3#") - echo "Extracted" - echo " Major: $MAJOR" - echo " Minor: $MINOR" - echo " Patch: $PATCH" + echo "Extracted: Major: $MAJOR Minor: $MINOR Patch: $PATCH"" ### CONTENT RECENTLY ADDED ### diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index b733114..2ca7a0d 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -52,14 +52,51 @@ jobs: # yamllint disable-line rule:line-length uses: os-climate/devops-reusable-workflows/.github/actions/semantic-tag-latest@main - - name: "Action: semantic-tag-increment" - id: semantic-tag-increment + - name: "Action: semantic-tag-increment [patch]" + id: semantic-tag-increment-patch # yamllint disable-line rule:line-length uses: os-climate/devops-reusable-workflows/.github/actions/semantic-tag-increment@main with: - tag: "${{ steps.semantic-tag-latest.outputs.tag }}" + tag: "v2.9.6" + type: "patch" + + - name: "Action: semantic-tag-increment [minor]" + id: semantic-tag-increment-minor + # yamllint disable-line rule:line-length + uses: os-climate/devops-reusable-workflows/.github/actions/semantic-tag-increment@main + with: + tag: "v0.1.2" type: "minor" + - name: "Action: semantic-tag-increment [major]" + id: semantic-tag-increment-major + # yamllint disable-line rule:line-length + uses: os-climate/devops-reusable-workflows/.github/actions/semantic-tag-increment@main + with: + tag: "v1.2.3" + type: "major" + + - name: "Validate Incremented Tags" + shell: bash + run: | + # Check output from: semantic-tag-increment + ERRORS="false" + if [ "${{ steps.semantic-tag-increment-patch.outputs.tag }}" != "v2.9.7" ]; then + echo "Errors with: semantic-tag-increment [patch]" + ERRORS="true" + fi + if [ "${{ steps.semantic-tag-increment-minor.outputs.tag }}" != "0.2.0" ]; then + echo "Errors with: semantic-tag-increment [minor]" + ERRORS="true" + fi + if [ "${{ steps.semantic-tag-increment-major.outputs.tag }}" != "1.0.0" ]; then + echo "Errors with: semantic-tag-increment [major]" + ERRORS="true" + fi + if [ "$ERRORS" = "true" ]; then + echo "Logic implementing tag handling needs checking"; exit 1 + fi + - name: "Action: url-validity-check" id: url-validity-check # yamllint disable-line rule:line-length