diff --git a/.github/workflows/create-release-and-upload-assets.yml b/.github/workflows/create-release-and-upload-assets.yml index 1aeba0f..e96e298 100644 --- a/.github/workflows/create-release-and-upload-assets.yml +++ b/.github/workflows/create-release-and-upload-assets.yml @@ -46,7 +46,7 @@ jobs: run: | apt update export DEBIAN_FRONTEND=noninteractive - apt -y install python3-setuptools debhelper dh-exec dh-python git-buildpackage + apt -y install python3-setuptools debhelper dh-exec dh-python git-buildpackage yarnpkg - name: Fix sh so env vars propogate run: | rm /bin/sh @@ -54,14 +54,14 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - ref: master + ref: main - name: git fetch --all run: | git config --global --add safe.directory /__w/openvpn-monitor/openvpn-monitor git fetch --all - name: Get version run: | - export version=$(echo "${{ github.ref }}" | cut -dv -f2) + export version=$(echo "${{ github.ref }}" | cut -d/ -f3) echo "version=${version}" >> $GITHUB_ENV - name: Download upload_url artifact uses: actions/download-artifact@v4 @@ -73,21 +73,25 @@ jobs: export upload_url=$(> $GITHUB_ENV - - name: Build deb packages + - name: Build deb package env: EMAIL: furlongm@gmail.com COMMIT_MSG: | auto-commit skip-checks: true run: | - export version=$(echo "${{ github.ref }}" | cut -dv -f2) + export version=$(echo "${{ github.ref }}" | cut -d/ -f3) echo "${version}" > VERSION.txt git add VERSION.txt + yarnpkg --prod --modules-folder openvpn_monitor/static/dist install + find openvpn_monitor/static > debian/source/include-binaries + rm yarn.lock + git add debian/source/include-binaries openvpn_monitor/static/dist git diff --quiet && git diff --staged --quiet || git commit -m "${COMMIT_MSG}" - gbp dch --new-version=${version}-1 --release --distribution=stable --spawn-editor=never --commit --commit-msg="${COMMIT_MSG}" - git tag --delete v${version} - git tag v${version} - gbp buildpackage --git-upstream-tree=${{ github.ref }} -uc -us + gbp dch --ignore-branch --new-version=${version}-1 --release --distribution=stable --spawn-editor=never --commit --commit-msg="${COMMIT_MSG}" + git tag --delete ${version} + git tag ${version} + gbp buildpackage --git-ignore-branch --git-upstream-tree=${{ github.ref }} -uc -us - name: Get version run: echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Upload deb @@ -97,7 +101,7 @@ jobs: with: upload_url: ${{ env.upload_url }} asset_name: ${{ format('python3-openvpn-monitor_{0}-1_all.deb', env.version) }} - asset_path: ${{ format('deb_dist/python3-openvpn-monitor_{0}-1_all.deb', env.version) }} + asset_path: ${{ format('../python3-openvpn-monitor_{0}-1_all.deb', env.version) }} asset_content_type: application/vnd.debian.binary-package build-and-upload-rpm-asset: needs: create-release @@ -107,7 +111,9 @@ jobs: steps: - name: Install build dependencies run: | - dnf -y install rpm-build python3 python3-setuptools git + dnf -y install epel-release + dnf makecache + dnf -y install rpm-build python3 python3-setuptools git yarnpkg - uses: actions/checkout@v4 - name: Download upload_url artifact uses: actions/download-artifact@v4 @@ -118,8 +124,9 @@ jobs: export upload_url=$(cat upload_url.txt) rm upload_url.txt echo "upload_url=${upload_url}" >> $GITHUB_ENV - - name: Build rpm packages + - name: Build rpm package run: | + yarnpkg --prod --modules-folder openvpn_monitor/static/dist install| sed -i -e "s/name='.*/name='python3-openvpn-monitor',/" setup.py python3 setup.py bdist_rpm - name: Get version @@ -136,6 +143,11 @@ jobs: upload-package-to-pypi: needs: create-release runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/openvpn-monitor + permissions: + id-token: write steps: - uses: actions/checkout@v4 - name: Set up python @@ -144,9 +156,12 @@ jobs: python-version: '3.x' - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish + sudo apt -y install yarnpkg + python3 -m pip install --upgrade pip + pip3 install setuptools wheel + - name: Build dists run: | - python setup.py sdist bdist_wheel - twine upload dist/* + yarnpkg --prod --modules-folder openvpn_monitor/static/dist install + python3 setup.py sdist bdist_wheel + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 40095bd..8f749e8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,11 +17,11 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + python3 -m pip install --upgrade pip + pip3 install -r requirements.txt - name: Lint with flake8 run: | - pip install flake8 + pip3 install flake8 # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide diff --git a/debian/control b/debian/control index 1c3e43c..73e49ea 100644 --- a/debian/control +++ b/debian/control @@ -3,18 +3,18 @@ Section: python Priority: optional Maintainer: Marcus Furlong Uploaders: Marcus Furlong -Build-Depends: debhelper (>=10-.0.0), python (>=3), dh-python +Build-Depends: debhelper (>=10.0.0), python3 (>=3.11.0), dh-python Standards-Version: 3.9.7 Homepage: https://github.com/furlongm/openvpn-monitor Vcs-Git: git://github.com/furlongm/openvpn-monitor Vcs-Browser: https://github.com/furlongm/openvpn-monitor -X-Python-Version: >= 3 +X-Python-Version: >= 3.11.0 Package: python3-openvpn-monitor Architecture: all Homepage: https://github.com/furlongm/openvpn-monitor -Depends: ${misc:Depends}, python3, apache2, libapache2-mod-wsgi, - python3-geoip2, python3-humanize, python3-flask, python3-flaskext.wtf +Depends: ${misc:Depends}, python3, apache2, libapache2-mod-wsgi-py3, + python3-geoip2, python3-humanize, python3-flask, python3-flaskext.wtf, python3-semver Description: openvpn-monitor is a web based OpenVPN monitor, that shows current connection information, such as users, location and data transferred. diff --git a/debian/python3-openvpn-monitor.postinst b/debian/python3-openvpn-monitor.postinst index e5cd634..692b592 100644 --- a/debian/python3-openvpn-monitor.postinst +++ b/debian/python3-openvpn-monitor.postinst @@ -6,5 +6,5 @@ if [ "$1" = "configure" ] ; then echo 'WSGIScriptAlias /openvpn-monitor /usr/lib/python3/dist-packages/openvpn_monitor/app.py' > /etc/apache2/conf-available/python3-openvpn-monitor.conf . /usr/share/apache2/apache2-maintscript-helper - apache2_invoke enconf python2-openvpn-monitor.conf + apache2_invoke enconf python3-openvpn-monitor.conf fi diff --git a/setup.py b/setup.py index 7dc7720..49e24d0 100755 --- a/setup.py +++ b/setup.py @@ -31,8 +31,8 @@ data_files = [] -for dirpath, dirnames, filenames in os.walk('openvpn_monitor/static/images/flags'): - data_files = [('share/openvpn-monitor/images/flags', +for dirpath, dirnames, filenames in os.walk('openvpn_monitor/static'): + data_files = [('share/openvpn-monitor/static', [os.path.join(dirpath, f) for f in filenames])] if sys.prefix == '/usr':