From ccedfb143db91997c98e8872e9fbdbb40eb515fa Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Tue, 22 Dec 2020 16:16:08 +0000 Subject: [PATCH] Adjust release drafter --- .github/workflows/release-drafter.yml | 32 +++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 8c31cdd..179f450 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -2,12 +2,40 @@ name: Release Drafter on: push: - branches: ["main"] + branches: + - main jobs: update_release_draft: runs-on: ubuntu-latest + name: Release Drafter steps: - - uses: release-drafter/release-drafter@v5 + - name: Checkout the repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Find Next Version + id: version + run: | + declare -i newpost + latest=$(git describe --tags $(git rev-list --tags --max-count=1)) + latestpre=$(echo "$latest" | awk '{split($0,a,"."); print a[1] "." a[2]}') + datepre=$(date --utc '+%y.%m') + if [[ "$latestpre" == "$datepre" ]]; then + latestpost=$(echo "$latest" | awk '{split($0,a,"."); print a[3]}') + newpost=$latestpost+1 + else + newpost=0 + fi + echo Current version: $latest + echo New target version: $datepre.$newpost + echo "::set-output name=version::$datepre.$newpost" + + - name: Run Release Drafter + uses: release-drafter/release-drafter@v5 + with: + tag: ${{ steps.version.outputs.version }} + name: ${{ steps.version.outputs.version }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}