Skip to content

Commit 7bb1649

Browse files
committed
update: git release detail logs
1 parent bfaa5fe commit 7bb1649

File tree

3 files changed

+64
-25
lines changed

3 files changed

+64
-25
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,33 @@ name: Release
33
on:
44
push:
55
tags:
6-
- '*'
6+
- "*"
77

8-
permissions:
9-
contents: write
8+
permissions:
9+
contents: write
1010

1111
jobs:
12-
build:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout Repository
16-
uses: actions/checkout@v2
17-
18-
- name: Set up Python 3.8
19-
uses: actions/setup-python@v2
20-
with:
21-
python-version: '3.x'
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v2
2217

23-
- run: python3 craft.py
18+
- name: Set up Python 3.8
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: "3.x"
2422

25-
- run: |
26-
python3 verify.py ./createhackenv.sh >> version.txt
27-
echo '```' >> version.txt
23+
- run: python3 craft.py
2824

29-
- name: Create Release
30-
uses: softprops/action-gh-release@v1
31-
env:
32-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
with:
34-
body_path: ${{ github.workspace }}/version.txt
35-
files: |
36-
${{ github.workspace }}/createhackenv.sh
25+
- run: |
26+
python3 ./releaser.py > version.txt
27+
28+
- name: Create Release
29+
uses: softprops/action-gh-release@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
body_path: ${{ github.workspace }}/version.txt
34+
files: |
35+
${{ github.workspace }}/createhackenv.sh

gitcmd.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
LATEST_TAG=`git tag --sort=refname |tail -n 2 |head -n 1`
2+
NEW_TAG=`git tag --sort=refname |tail -n 1`
3+
git log --format='%(trailers:key=Type,valueonly,separator=%x20)%x1c%s [%(trailers:key=Issue,valueonly,separator=,)]' $LATEST_TAG..$NEW_TAG | awk -F "\034" '
4+
{
5+
gsub(/\[\]$/, "", $2);
6+
if (length($1) == 0) $1="";
7+
if (!($1 in item_count)) item_count[$1]=0;
8+
items[$1, item_count[$1]]=$2;
9+
item_count[$1]++;
10+
}
11+
END {
12+
for (k in item_count) {
13+
print k;
14+
k2=k;
15+
gsub(/./, "-", k2);
16+
print k2
17+
for (i=0; i<item_count[k]; i++) print "* "items[k, i];
18+
print ""
19+
}
20+
}'

version.txt renamed to releaser.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
template = """
12
# Weaponaized your VSCode
23
34
## What is this?
@@ -18,3 +19,22 @@
1819
## Script Hash
1920
2021
```
22+
__VERIFY_OUTPUT__
23+
```
24+
25+
## Update Log
26+
27+
__UPDATE_LOGS__
28+
29+
"""
30+
31+
import os
32+
33+
def main():
34+
verify_output = os.popen("python3 ./verify.py ./creathackenv.sh").read()
35+
update_logs = os.popen("bash ./gitcmd.sh").read()
36+
print(template.replace("__VERIFY_OUTPUT__", verify_output).replace("__UPDATE_LOGS__", update_logs))
37+
pass
38+
39+
if __name__ == "__main__":
40+
main()

0 commit comments

Comments
 (0)