Skip to content

Commit

Permalink
update github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
furlongm committed Dec 23, 2024
1 parent cd05d6f commit 85245e4
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
49 changes: 32 additions & 17 deletions .github/workflows/create-release-and-upload-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ 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
ln -sf /bin/bash /bin/sh
- 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
Expand All @@ -73,21 +73,25 @@ jobs:
export upload_url=$(<upload_url.txt)
rm upload_url.txt
echo "upload_url=${upload_url}" >> $GITHUB_ENV
- name: Build deb packages
- name: Build deb package
env:
EMAIL: [email protected]
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ Section: python
Priority: optional
Maintainer: Marcus Furlong <[email protected]>
Uploaders: Marcus Furlong <[email protected]>
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
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.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down

0 comments on commit 85245e4

Please sign in to comment.