From 7bb1649429234638ec7652e7e2c31f049fd47b97 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Tue, 18 Jun 2024 16:28:38 +0800 Subject: [PATCH] update: git release detail logs --- .github/workflows/release.yml | 49 +++++++++++++++++------------------ gitcmd.sh | 20 ++++++++++++++ version.txt => releaser.py | 20 ++++++++++++++ 3 files changed, 64 insertions(+), 25 deletions(-) create mode 100644 gitcmd.sh rename version.txt => releaser.py (56%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 727e6ed..86a7bba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,34 +3,33 @@ name: Release on: push: tags: - - '*' + - "*" -permissions: - contents: write +permissions: + contents: write jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: '3.x' + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 - - run: python3 craft.py + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: "3.x" - - run: | - python3 verify.py ./createhackenv.sh >> version.txt - echo '```' >> version.txt + - run: python3 craft.py - - name: Create Release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - body_path: ${{ github.workspace }}/version.txt - files: | - ${{ github.workspace }}/createhackenv.sh \ No newline at end of file + - run: | + python3 ./releaser.py > version.txt + + - name: Create Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + body_path: ${{ github.workspace }}/version.txt + files: | + ${{ github.workspace }}/createhackenv.sh diff --git a/gitcmd.sh b/gitcmd.sh new file mode 100644 index 0000000..ee2695c --- /dev/null +++ b/gitcmd.sh @@ -0,0 +1,20 @@ +LATEST_TAG=`git tag --sort=refname |tail -n 2 |head -n 1` +NEW_TAG=`git tag --sort=refname |tail -n 1` +git log --format='%(trailers:key=Type,valueonly,separator=%x20)%x1c%s [%(trailers:key=Issue,valueonly,separator=,)]' $LATEST_TAG..$NEW_TAG | awk -F "\034" ' + { + gsub(/\[\]$/, "", $2); + if (length($1) == 0) $1=""; + if (!($1 in item_count)) item_count[$1]=0; + items[$1, item_count[$1]]=$2; + item_count[$1]++; + } + END { + for (k in item_count) { + print k; + k2=k; + gsub(/./, "-", k2); + print k2 + for (i=0; i