diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index 9267c57..33446ca 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -1,3 +1,4 @@ +name: Auto-tag on: push: tags: @@ -8,7 +9,4 @@ jobs: runs-on: ubuntu-latest steps: - name: Auto-tag - uses: emteknetnz/gha-auto-tag@main - with: - ref: ${{ github.ref }} - sha: ${{ github.sha }} + uses: silverstripe/gha-auto-tag@main diff --git a/README.md b/README.md index fb04cd5..5fabfae 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Using the 'v' prefix to avoid confusion with the '2' branch naming convention th ## Usage -.github/workflows/auto-tag.yml +**.github/workflows/auto-tag.yml** ```yml on: push: @@ -27,8 +27,4 @@ jobs: steps: - name: Auto-tag uses: silverstripe/gha-auto-tag@main - with: - ref: ${{ github.ref }} - sha: ${{ github.sha }} - ``` diff --git a/action.yml b/action.yml index 0c7e68e..37c9d3c 100644 --- a/action.yml +++ b/action.yml @@ -1,36 +1,20 @@ name: Auto-tag description: Automatically delete and re-release tags so that other github action modules can use something similar to carets e.g. v0.1 or v3 -inputs: - ref: - type: string - required: true - description: github.ref when workflow is triggered by x.y.z semver tag e.g. refs/tags/0.1.23 - sha: - type: string - required: true - description: SHA of the tag runs: using: composite steps: - - name: Validate inputs + - name: Validate ref shell: bash env: - REF: ${{ inputs.ref }} - SHA: ${{ inputs.sha }} + REF: ${{ github.ref }} run: | # refs/tags/0.1.23 => 0.1.23 TAG=$(echo $REF | cut -c 11-) if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "Valid tag $TAG" + echo "Valid semver tag $TAG" else - echo "Invalid tag $TAG" - exit 1 - fi - if [[ "$SHA" =~ ^[0-9a-f]{40}$ ]]; then - echo "Valid sha $SHA" - else - echo "Invalid sha $SHA" + echo "Invalid semver tag $TAG" exit 1 fi @@ -38,7 +22,7 @@ runs: id: generate_tag_name shell: bash env: - REF: ${{ inputs.ref }} + REF: ${{ github.ref }} run: | # refs/tags/0.1.23 => 0.1.23 TAG=$(echo $REF | cut -c 11-) @@ -54,9 +38,9 @@ runs: echo "::set-output name=tag::$NEW_TAG" - name: Add tag to repo - uses: silverstripe/gha-tag-release@main + # TODO: change to silverstripe/gha-tag-release + uses: emteknetnz/gha-tag-release@main with: - sha: ${{ github.sha }} tag: ${{ steps.generate_tag_name.outputs.tag }} delete_existing: true release: false