Add AppImage to build workflow

This commit is contained in:
Veronica Berglyd Olsen
2023-02-12 23:27:15 +01:00
parent d672ec05e9
commit 8448ec7b61
2 changed files with 61 additions and 16 deletions
+54 -11
View File
@@ -20,13 +20,13 @@ jobs:
- name: Checkout Source - name: Checkout Source
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Run Build Commands - name: Build Assets
run: python setup.py qtlrelease sample manual run: python setup.py qtlrelease sample manual
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: nw-assets-${{ github.sha }} name: nw-assets
path: | path: |
novelwriter/assets/sample.zip novelwriter/assets/sample.zip
novelwriter/assets/manual.pdf novelwriter/assets/manual.pdf
@@ -34,6 +34,49 @@ jobs:
if-no-files-found: error if-no-files-found: error
retention-days: 1 retention-days: 1
buildLinux:
needs: buildAssets
runs-on: ubuntu-latest
env:
LINUX_TAG: "manylinux_2_28_x86_64"
PY_VER: "3.10"
steps:
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: 3
architecture: x64
- name: Install Packages (pip)
run: pip install python-appimage
- name: Checkout Source
uses: actions/checkout@v3
- name: Get Version
shell: bash
run: |
NW_VER=$(python setup.py version)
echo "novelWriter Version: $NW_VER"
echo "VERSION=$NW_VER" >> $GITHUB_ENV
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: nw-assets
path: novelwriter/assets
- name: Build AppImage
run: python setup.py build-appimage --linux-tag {{env.LINUX_TAG}} --python-version {{env.PY_VER}}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: novelWriter-{{env.VERSION}}-py{{env.PY_VER}}-{{env.LINUX_TAG}}.AppImage
path: dist_appimage/novelWriter-{{env.VERSION}}-py{{env.PY_VER}}-{{env.LINUX_TAG}}.AppImage
if-no-files-found: error
retention-days: 1
buildMac: buildMac:
needs: buildAssets needs: buildAssets
strategy: strategy:
@@ -46,21 +89,20 @@ jobs:
- name: Get Version - name: Get Version
shell: bash shell: bash
run: | run: |
NW_VERSION=`awk '/^__version__/{print substr($NF,2,length($NF)-2)}' novelwriter/__init__.py` NW_VER=$(python setup.py version)
echo "novelWriter Version: $NW_VERSION" echo "novelWriter Version: $NW_VER"
echo "VERSION=$NW_VERSION" >> $GITHUB_ENV echo "VERSION=$NW_VER" >> $GITHUB_ENV
- name: Download Artifact - name: Download Artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: nw-assets-${{ github.sha }} name: nw-assets
path: novelwriter/assets path: novelwriter/assets
- name: Build - name: Build App Bundle
run: | run: ./setup/macos/build.sh
./setup/macos/build.sh
- name: Upload ZIP - name: Upload App Zip
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: novelWriter-${{ env.VERSION }}-macos.app.zip name: novelWriter-${{ env.VERSION }}-macos.app.zip
@@ -72,4 +114,5 @@ jobs:
with: with:
name: novelWriter-${{ env.VERSION }}-macos.dmg name: novelWriter-${{ env.VERSION }}-macos.dmg
path: dist_macos/novelWriter-${{ env.VERSION }}-macos.dmg path: dist_macos/novelWriter-${{ env.VERSION }}-macos.dmg
if-no-files-found: error
retention-days: 1 retention-days: 1
+7 -5
View File
@@ -42,7 +42,7 @@ OS_DARWIN = 3
# Utilities # Utilities
# =============================================================================================== # # =============================================================================================== #
def extractVersion(): def extractVersion(beQuiet=False):
"""Extract the novelWriter version number without having to import """Extract the novelWriter version number without having to import
anything else from the main package. anything else from the main package.
""" """
@@ -67,7 +67,8 @@ def extractVersion():
print("Could not read file: %s" % initFile) print("Could not read file: %s" % initFile)
print(str(exc)) print(str(exc))
print("novelWriter version: %s (%s) at %s" % (numVers, hexVers, relDate)) if not beQuiet:
print("novelWriter version: %s (%s) at %s" % (numVers, hexVers, relDate))
return numVers, hexVers, relDate return numVers, hexVers, relDate
@@ -935,7 +936,7 @@ def makeForLaunchpad(doSign=False, isFirst=False, isSnapshot=False):
## ##
def makeAppImage(sysArgs): def makeAppImage(sysArgs):
"""Build an Appimage """Build an Appimage.
""" """
import glob import glob
import argparse import argparse
@@ -1882,6 +1883,7 @@ if __name__ == "__main__":
"", "",
" help Print the help message.", " help Print the help message.",
" pip Install all package dependencies for novelWriter using pip.", " pip Install all package dependencies for novelWriter using pip.",
" version Print the novelWriter version.",
" build-clean Will attempt to delete 'build' and 'dist' folders.", " build-clean Will attempt to delete 'build' and 'dist' folders.",
"", "",
"Additional Builds:", "Additional Builds:",
@@ -1939,8 +1941,8 @@ if __name__ == "__main__":
if "version" in sys.argv: if "version" in sys.argv:
sys.argv.remove("version") sys.argv.remove("version")
print("Checking source version info ...") numVers, _, _ = extractVersion(beQuiet=True)
extractVersion() print(numVers, end=None)
sys.exit(0) sys.exit(0)
if "pip" in sys.argv: if "pip" in sys.argv: