diff --git a/.github/scripts/tag.sh b/.github/scripts/tag.sh index 54ffdbc..e3e1c7c 100755 --- a/.github/scripts/tag.sh +++ b/.github/scripts/tag.sh @@ -2,9 +2,11 @@ set -e -head_tag=$(git describe --exact-match 2>/dev/null | true) +head_tag=$(git describe --exact-match 2>/dev/null || true) -if [[ ${head_tag} =~ [\d{2}.\d{2}.\d+] ]] +git log --color=always --format="%C(auto)%h %s%d" | head + +if [[ ${head_tag} =~ [\d{2}\.\d{2}\.\d+] ]] then echo "Current master already has version tag ${head_tag}" else @@ -13,6 +15,7 @@ else version=$(date +'%y.%m.0') git tag -a ${version} -m "Release ${version}" git push origin ${version} + git log --color=always --format="%C(auto)%h %s%d" | head -1 echo "Pushed new tag:" - echo "${{github.server_url}}/${{github.repository}}/tag/${version}" + echo "${REPO_URL}/releases/tag/${version}" fi diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4c773ca..33f0a6b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index 6a5ba1b..5def115 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -1,20 +1,22 @@ -name: Tag - -on: - schedule: - # Run on every first day of the month - - cron: '0 0 1 * *' - -jobs: - - tag: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Create Tag - run: .github/scripts/tag.sh +name: Tag + +on: + schedule: + # Run on every first day of the month + - cron: '0 0 1 * *' + +jobs: + + tag: + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Create Tag + run: .github/scripts/tag.sh + env: + REPO_URL: ${{github.server_url}}/${{github.repository}}