Skip to content

Commit 71efaa3

Browse files
committed
fix type update workflow
1 parent 638c266 commit 71efaa3

2 files changed

Lines changed: 24 additions & 16 deletions

File tree

.github/workflows/update_specific_types.yaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,17 @@ jobs:
2222
id: script
2323
run: "poetry run python tools/update_specific_types.py"
2424
- name: Push
25-
if: ${{ steps.script.outputs.release }} == true
25+
if: ${{ steps.script.outputs.release }} == "true"
2626
uses: stefanzweifel/git-auto-commit-action@v4
27-
- name: "Get Previous tag"
28-
if: ${{ steps.script.outputs.release }} == true
29-
id: previoustag
30-
uses: "WyriHaximus/github-action-get-previous-tag@v1"
31-
- name: "Get next minor version"
32-
if: ${{ steps.script.outputs.release }} == true
33-
id: semvers
34-
uses: "WyriHaximus/github-action-next-semvers@v1"
35-
with:
36-
version: ${{ steps.previoustag.outputs.tag }}
3727
- name: Create Release
38-
if: ${{ steps.script.outputs.release }} == true
28+
if: ${{ steps.script.outputs.release }} == "true"
3929
id: create_release
4030
uses: actions/create-release@latest
4131
env:
4232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4333
with:
44-
tag_name: ${{ steps.semvers.outputs.patch }}
34+
tag_name: ${{ steps.script.outputs.tag }}
4535
release_name: Release ${{ github.ref }}
46-
body: "This automated release was created, because there are new things in Minecraft."
36+
body: "Added support for Minecraft ${{ steps.script.outputs.mcver }}"
4737
draft: false
4838
prerelease: false

tools/update_specific_types.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,24 @@ def hash(pth):
130130
if not hash(basePath + f) in hashes:
131131
newReleaseRequired = True
132132

133-
print("Done.")
133+
os.system(
134+
f'echo "release={("true" if newReleaseRequired else "false")}" >> $GITHUB_OUTPUT'
135+
)
136+
137+
if newReleaseRequired:
138+
print("There will be a new release.")
139+
print("Getting current tag...")
140+
tag = requests.get(
141+
"https://api.github.com/repos/PaddeCraft/PyMCFunction/tags"
142+
).json()[0]["name"]
143+
print("Calculating new tag...")
144+
patch = int(tag.split(".")[2]) + 1
145+
newTagParts = tag.split(".")
146+
newTagParts[2] = str(patch)
147+
newTag = ".".join(newTagParts)
148+
149+
print("New release tag:", newTag)
150+
os.system(f'echo "tag={newTag}" >> $GITHUB_OUTPUT')
151+
os.system(f'echo "mcver={latestVersion}" >> $GITHUB_OUTPUT')
134152

135-
print("::set-output name=release::" + ("true" if newReleaseRequired else "false"))
153+
print("Done.")

0 commit comments

Comments
 (0)