mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Merge pull request #567 from Arfs6/create-github-releases-action
Created release.yml - action file for automated release on push.
This commit is contained in:
commit
19e18bcfe1
43
.github/workflows/release.yml
vendored
Normal file
43
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Release a new TW Blue installer on github.
|
||||||
|
# This workflow runs on push.
|
||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["release"]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
# Builds an x64 binary and an installer of TW Blue.
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: clone repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
- name: Get python interpreter
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
|
||||||
|
- name: Install python packages
|
||||||
|
run: python -m pip install -r requirements.txt
|
||||||
|
|
||||||
|
- name: Build binary
|
||||||
|
run: |
|
||||||
|
.\scripts\build.ps1
|
||||||
|
mv src/dist scripts\TWBlue64
|
||||||
|
|
||||||
|
- name: make installer
|
||||||
|
run: |
|
||||||
|
cd scripts
|
||||||
|
makensis twblue.nsi
|
||||||
|
|
||||||
|
- name: Create new release
|
||||||
|
env:
|
||||||
|
gh_token: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
mkdir .release-assets
|
||||||
|
mv scripts\TWBlue_setup.exe .release-assets\TWBlue_setup_$(cat version.txt).exe
|
||||||
|
7z a -tzip .release-assets\TWBlue_portable_$(cat version.txt).zip scripts\TWBlue64
|
||||||
|
gh release create release -n "New version of TWBlue." -t "Version $(cat version.txt)" .release-assets\TWBlue_setup_$(cat version.txt).exe .release-assets\TWBlue_portable_$(cat version.txt).zip
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -20,4 +20,5 @@ release-snapshot/
|
|||||||
src/com_cache/
|
src/com_cache/
|
||||||
doc/strings.py
|
doc/strings.py
|
||||||
doc/changelog.py
|
doc/changelog.py
|
||||||
env/
|
env/
|
||||||
|
version.txt
|
||||||
|
16
scripts/build.ps1
Normal file
16
scripts/build.ps1
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Build a TW Blue installer.
|
||||||
|
# Must be called from root of repo
|
||||||
|
echo "Generating documentation..."
|
||||||
|
cd doc
|
||||||
|
python documentation_importer.py
|
||||||
|
python generator.py
|
||||||
|
mv documentation ..\src
|
||||||
|
cd ..
|
||||||
|
echo "done."
|
||||||
|
|
||||||
|
echo "Building binary..."
|
||||||
|
cd src
|
||||||
|
python write_version_data.py
|
||||||
|
python setup.py build
|
||||||
|
cd ..
|
||||||
|
echo "done."
|
@ -58,7 +58,8 @@ SetOutPath "$INSTDIR"
|
|||||||
${If} ${RunningX64}
|
${If} ${RunningX64}
|
||||||
File /r TWBlue64\*
|
File /r TWBlue64\*
|
||||||
${Else}
|
${Else}
|
||||||
File /r TWBlue\*
|
messagebox MB_ICONSTOP "Error: This TWBlue installer is only compatible with 64-bit systems. TWBlue does not support 32 bit systems any more."
|
||||||
|
Quit
|
||||||
${EndIf}
|
${EndIf}
|
||||||
CreateShortCut "$DESKTOP\TWBlue.lnk" "$INSTDIR\TWBlue.exe"
|
CreateShortCut "$DESKTOP\TWBlue.lnk" "$INSTDIR\TWBlue.exe"
|
||||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN startmenu
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN startmenu
|
||||||
|
@ -10,9 +10,10 @@ commit_info = requests.get("https://gitlab.com/api/v4/projects/23482196/reposito
|
|||||||
commit_info = commit_info.json()
|
commit_info = commit_info.json()
|
||||||
commit = commit_info["short_id"]
|
commit = commit_info["short_id"]
|
||||||
print("Got new version info: {commit}".format(commit=commit,))
|
print("Got new version info: {commit}".format(commit=commit,))
|
||||||
|
new_version = commit_info["created_at"][:10].replace("-", ".")
|
||||||
file = open("application.py", "r", encoding="utf-8")
|
file = open("application.py", "r", encoding="utf-8")
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
lines[-1] = 'version = "{}"'.format(commit_info["created_at"][:10].replace("-", "."))
|
lines[-1] = 'version = "{}"'.format(new_version)
|
||||||
file.close()
|
file.close()
|
||||||
file2 = open("application.py", "w", encoding="utf-8")
|
file2 = open("application.py", "w", encoding="utf-8")
|
||||||
file2.writelines(lines)
|
file2.writelines(lines)
|
||||||
@ -22,9 +23,15 @@ print("Wrote application.py with the new version info.")
|
|||||||
print("Updating next version on installer setup...")
|
print("Updating next version on installer setup...")
|
||||||
file = open("..\\scripts\\twblue.nsi", "r", encoding="utf-8")
|
file = open("..\\scripts\\twblue.nsi", "r", encoding="utf-8")
|
||||||
contents = file.read()
|
contents = file.read()
|
||||||
contents = contents.replace("0.95", commit_info["created_at"][:10].replace("-", "."))
|
contents = contents.replace("0.95", new_version)
|
||||||
file.close()
|
file.close()
|
||||||
file2 = open("..\\scripts\\twblue.nsi", "w", encoding="utf-8")
|
file2 = open("..\\scripts\\twblue.nsi", "w", encoding="utf-8")
|
||||||
file2.write(contents)
|
file2.write(contents)
|
||||||
file2.close()
|
file2.close()
|
||||||
print("done")
|
print("done")
|
||||||
|
|
||||||
|
print("Writing new version to version.txt")
|
||||||
|
version_txt = open("../version.txt", "w", encoding="utf8")
|
||||||
|
version_txt.write(new_version)
|
||||||
|
version_txt.close()
|
||||||
|
print("Done.")
|
||||||
|
Loading…
Reference in New Issue
Block a user