Skip to content

Commit 3f5d08a

Browse files
committed
build: for 0.1.4 release
1 parent a16c015 commit 3f5d08a

File tree

7 files changed

+167
-33
lines changed

7 files changed

+167
-33
lines changed

.github/workflows/build_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
path: site/
2424

2525
deploy:
26-
# if: github.ref == 'refs/heads/main' && github.event_name == 'push'
26+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
2727
needs:
2828
- build
2929
permissions:

.github/workflows/release.yml

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,45 +33,30 @@ jobs:
3333
path: |
3434
bin/
3535
36-
upload-to-release:
37-
needs:
38-
- build
36+
update-release-notes:
3937
permissions:
4038
contents: write
4139
runs-on: ubuntu-latest
42-
strategy:
43-
matrix:
44-
backend:
45-
# - libnode
46-
- lua
47-
# - python310
48-
- quickjs
4940
steps:
5041
- uses: actions/checkout@v4
5142

52-
- uses: actions/download-artifact@v3
53-
with:
54-
name: legacy-script-engine-${{ matrix.backend }}-windows-x64-${{ github.sha }}
55-
path: release/
56-
57-
- run: |
58-
cp COPYING README.md release/
59-
60-
- name: Archive release
43+
- name: Validate release stuff (tooth.json, CHANGELOG.md, etc.)
6144
run: |
62-
cd release
63-
zip -r ../legacy-script-engine-${{ matrix.backend }}-windows-x64.zip *
64-
cd ..
45+
npm i -g keep-a-changelog
46+
python scripts/validate_release.py --tag ${{ github.event.release.tag_name }}
47+
48+
- id: extract-release-notes
49+
uses: ffurrer2/extract-release-notes@v1
6550

6651
- uses: softprops/action-gh-release@v1
6752
with:
68-
append_body: true
69-
files: |
70-
legacy-script-engine-${{ matrix.backend }}-windows-x64.zip
53+
body: |
54+
${{ steps.extract-release-notes.outputs.release_notes }}
7155
7256
upload-to-gitea:
7357
needs:
7458
- build
59+
- update-release-notes
7560
runs-on: ubuntu-latest
7661
strategy:
7762
matrix:
@@ -108,9 +93,44 @@ jobs:
10893
mv ../release/legacy-script-engine-${{ matrix.backend }} .
10994
cp ../tooth.template.json tooth.json
11095
sed -i "s/\${engine}/${{ matrix.backend }}/g" tooth.json
111-
sed -i "s/\${version}/$(echo ${{ github.event.release.tag_name }}|sed 's/v//')/g" tooth.json
11296
git add .
11397
git commit -m "Release ${{ github.event.release.tag_name }}"
11498
git tag ${{ github.event.release.tag_name }}
11599
git push
116100
git push --tags
101+
102+
upload-to-release:
103+
needs:
104+
- build
105+
- update-release-notes
106+
permissions:
107+
contents: write
108+
runs-on: ubuntu-latest
109+
strategy:
110+
matrix:
111+
backend:
112+
# - libnode
113+
- lua
114+
# - python310
115+
- quickjs
116+
steps:
117+
- uses: actions/checkout@v4
118+
119+
- uses: actions/download-artifact@v3
120+
with:
121+
name: legacy-script-engine-${{ matrix.backend }}-windows-x64-${{ github.sha }}
122+
path: release/
123+
124+
- run: |
125+
cp CHANGELOG.md COPYING README.md release/
126+
127+
- name: Archive release
128+
run: |
129+
cd release
130+
zip -r ../legacy-script-engine-${{ matrix.backend }}-windows-x64.zip *
131+
cd ..
132+
133+
- uses: softprops/action-gh-release@v1
134+
with:
135+
files: |
136+
legacy-script-engine-${{ matrix.backend }}-windows-x64.zip

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.4] - 2024-02-05
9+
10+
### Added
11+
12+
- First release.
13+
14+
[0.1.4]: https://github.com/LiteLDev/LegacyScriptEngine/releases/tag/v0.1.4
File renamed without changes.

scripts/validate_release.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import argparse
2+
import re
3+
import subprocess
4+
from typing import TypedDict
5+
6+
7+
class Args(TypedDict):
8+
tag: str
9+
10+
11+
def main():
12+
args = get_args()
13+
14+
version = args["tag"].lstrip("v")
15+
16+
validate_changelog(version)
17+
validate_tooth_json(version)
18+
validate_tooth_template_json(version)
19+
20+
21+
def get_args() -> Args:
22+
parser = argparse.ArgumentParser()
23+
parser.add_argument("--tag", required=True)
24+
25+
args = parser.parse_args()
26+
27+
return {
28+
"tag": args.tag,
29+
}
30+
31+
32+
def validate_changelog(version: str):
33+
try:
34+
subprocess.run(
35+
f"npx changelog --format markdownlint",
36+
shell=True,
37+
check=True,
38+
)
39+
except subprocess.CalledProcessError as e:
40+
print("Have you installed it by `npm i -g keep-a-changelog`?")
41+
raise e
42+
43+
with open("CHANGELOG.md", "r", encoding="utf-8") as f:
44+
content = f.read()
45+
46+
if not re.search(r"## \[{}\]".format(version), content):
47+
raise Exception("CHANGELOG.md lacks version {}".format(version))
48+
49+
50+
def validate_tooth_json(version: str):
51+
with open("tooth.json", "r", encoding="utf-8") as f:
52+
content = f.read()
53+
54+
if not re.search(r"\"version\": \"{}\"".format(version), content):
55+
raise Exception("tooth.json has wrong version")
56+
57+
if not re.search(
58+
r"\"gitea.litebds.com/LiteLDev/legacy-script-engine-lua\": \"{}\"".format(
59+
version
60+
),
61+
content,
62+
):
63+
raise Exception("tooth.json has wrong version in gitea.litebds.com/LiteLDev/legacy-script-engine-lua")
64+
65+
if not re.search(
66+
r"\"gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs\": \"{}\"".format(
67+
version
68+
),
69+
content,
70+
):
71+
raise Exception("tooth.json has wrong version in gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs")
72+
73+
def validate_tooth_template_json(version: str):
74+
with open("tooth.template.json", "r", encoding="utf-8") as f:
75+
content = f.read()
76+
77+
if not re.search(r"\"version\": \"{}\"".format(version), content):
78+
raise Exception("tooth.template.json has wrong version")
79+
80+
if __name__ == "__main__":
81+
main()

tooth.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"format_version": 2,
3+
"tooth": "github.com/LiteLDev/LegacyScriptEngine",
4+
"version": "0.1.4",
5+
"info": {
6+
"name": "LegacyScriptEngine",
7+
"description": "A plugin engine for running LLSE plugins on LeviLamina",
8+
"author": "LiteLDev",
9+
"tags": [
10+
"levilamina",
11+
"plugin-engine"
12+
]
13+
},
14+
"dependencies": {
15+
"gitea.litebds.com/LiteLDev/legacy-script-engine-lua": "0.1.4",
16+
"gitea.litebds.com/LiteLDev/legacy-script-engine-quickjs": "0.1.4"
17+
}
18+
}

tooth.template.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
{
22
"format_version": 2,
33
"tooth": "gitea.litebds.com/LiteLDev/legacy-script-engine-${engine}",
4-
"version": "${version}",
4+
"version": "0.1.4",
55
"info": {
6-
"name": "LegacyScriptEngine-${engine}",
6+
"name": "LegacyScriptEngine with ${engine} backend",
77
"description": "A plugin engine for running LLSE plugins on LeviLamina",
88
"author": "LiteLDev",
99
"tags": [
1010
"levilamina",
1111
"plugin-engine"
12-
],
13-
"source": "github.com/LiteLDev/LegacyScriptEngine"
12+
]
1413
},
15-
"prerequisites": {
16-
"github.com/LiteLDev/LeviLamina": "0.6.x >=0.6.3",
14+
"dependencies": {
1715
"github.com/LiteLDev/LegacyRemoteCall": ">=0.1.1",
1816
"github.com/LiteLDev/LegacyParticleAPI": ">=0.1.1",
1917
"github.com/LiteLDev/LegacyMoney": ">=0.1.6"
2018
},
19+
"prerequisites": {
20+
"github.com/LiteLDev/LeviLamina": "0.6.x >=0.6.3"
21+
},
2122
"files": {
2223
"place": [
2324
{

0 commit comments

Comments
 (0)