Skip to content

Commit

Permalink
generate DEB package in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch committed Oct 27, 2024
1 parent 2159e2a commit b39fd28
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,28 @@ jobs:
path: |
./build/ROSProjectManager-*-*-*.zip
- name: install Qt Creator DEB package
if: runner.os == 'Linux'
run: |
wget $(./packaging/format-deb-url.py) --directory-prefix=/tmp
sudo apt install /tmp/qtcreator-opensource-linux-*-*.deb
- name: generate plugin DEB package
if: runner.os == 'Linux'
run: |
cd build
cpack -G DEB
- name: upload artifact (DEB)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: plugin_archive_artifact_${{ matrix.config.name }}_deb
if-no-files-found: error
path: |
./build/ROSProjectManager-*-*-*.deb
./build/ROSProjectManager-*-*-*-dbgsym.ddeb
release:
name: create release
if: contains(github.ref, '/tags/')
Expand All @@ -75,4 +97,4 @@ jobs:
uses: ncipollo/release-action@v1
id: create_release
with:
artifacts: ROSProjectManager-*-*-*.zip
artifacts: ROSProjectManager-*-*-*.zip,ROSProjectManager-*-*-*.deb,ROSProjectManager-*-*-*-dbgsym.ddeb
48 changes: 48 additions & 0 deletions packaging/format-deb-url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python3
import platform
import argparse
import yaml


qtc_deb_url_fmt = "https://download.qt.io/{release_type}_releases/qtcreator/{qtcv_maj}/{qtcv_full}/cpack_experimental/qtcreator-opensource-linux-{arch}-{qtcv_full}.deb"

if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-v", '--version', type=str, default=None)
args = parser.parse_args()

if args.version is None:
# read version from file
with open("versions.yaml", 'r') as file:
versions = yaml.safe_load(file)
qtc_version = versions['qtc_version']
qtc_dev_tag = versions.get('qtc_dev_tag', str())
else:
# parse version from command line argument
vv = args.version.split('-')
qtc_version = vv[0]
qtc_dev_tag = vv[1] if len(vv) > 1 else str()

release = not qtc_dev_tag

if not release and (qtc_dev_tag.find("beta") == -1 and qtc_dev_tag.find("rc") == -1):
raise RuntimeWarning(f"Invalid development tag '{qtc_dev_tag}'. Valid tags contain 'beta' or 'rc'.")

ver_split = qtc_version.split('.')
qtc_ver_major = ver_split[0]
qtc_ver_minor = ver_split[1] if len(ver_split)>1 else 0
qtc_ver_patch = ver_split[2] if len(ver_split)>2 else 0
qtc_ver_maj = f"{qtc_ver_major}.{qtc_ver_minor}"
qtc_ver_full = f"{qtc_ver_maj}.{qtc_ver_patch}"

if not release:
qtc_ver_full += f"-{qtc_dev_tag}"

arch = platform.machine()

deb_url = qtc_deb_url_fmt.format(release_type = "official" if release else "development",
qtcv_maj = qtc_ver_maj,
qtcv_full = qtc_ver_full,
arch = arch,)

print(deb_url)

0 comments on commit b39fd28

Please sign in to comment.