mirror of
https://github.com/QSCTech/zjunet.git
synced 2026-01-22 19:54:48 +08:00
Add CI support (#76)
This commit is contained in:
parent
2fa9b0a1e8
commit
701a17a1e2
14
.github/workflows/packaging.yml
vendored
14
.github/workflows/packaging.yml
vendored
@ -18,8 +18,16 @@ jobs:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '^3.7' # request python 3.7+ for datetime.datetime.fromisoformat
|
||||
|
||||
- name: Build Packages
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install urllib3
|
||||
cd build
|
||||
./build.sh
|
||||
|
||||
@ -28,6 +36,6 @@ jobs:
|
||||
with:
|
||||
name: Release Packages
|
||||
path: |
|
||||
build/debain/*.deb
|
||||
build/rpm/*.rpm
|
||||
build/openwrt/*.opk
|
||||
build/debian/zjunet_*.deb
|
||||
build/rpm/zjunet_*.rpm
|
||||
build/openwrt/zjunet_*.opk
|
||||
|
||||
@ -6,17 +6,46 @@ fail() {
|
||||
echo -e "\033[31mERROR: Failed to build $1\033[0m" 1>&2
|
||||
}
|
||||
|
||||
pushd rpm > /dev/null
|
||||
./build.sh $VERSION || fail 'RPM package'
|
||||
popd > /dev/null
|
||||
if [[ $# -gt 0 ]]; then
|
||||
for arg in $*; do
|
||||
case $arg in
|
||||
rpm)
|
||||
USE_RPM=1
|
||||
;;
|
||||
debian)
|
||||
USE_DEB=1
|
||||
;;
|
||||
openwrt)
|
||||
USE_OPK=1
|
||||
;;
|
||||
*)
|
||||
echo "Invalid package $arg"
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
else
|
||||
USE_RPM=1
|
||||
USE_DEB=1
|
||||
USE_OPK=1
|
||||
fi
|
||||
|
||||
pushd debian > /dev/null
|
||||
./build.sh $VERSION || fail 'Debian package'
|
||||
popd > /dev/null
|
||||
if [[ ! -z $USE_RPM ]]; then
|
||||
pushd rpm > /dev/null
|
||||
./build.sh $VERSION || fail 'RPM package'
|
||||
popd > /dev/null
|
||||
fi
|
||||
|
||||
pushd openwrt > /dev/null
|
||||
./build.sh $VERSION || fail 'OpenWrt package'
|
||||
popd > /dev/null
|
||||
if [[ ! -z $USE_DEB ]]; then
|
||||
pushd debian > /dev/null
|
||||
./build.sh $VERSION || fail 'Debian package'
|
||||
popd > /dev/null
|
||||
fi
|
||||
|
||||
if [[ ! -z $USE_OPK ]]; then
|
||||
pushd openwrt > /dev/null
|
||||
./build.sh $VERSION || fail 'OpenWrt package'
|
||||
popd > /dev/null
|
||||
fi
|
||||
|
||||
echo -ne "\033[0;32m"
|
||||
find . -regextype posix-egrep -regex ".*\.(opk|deb|rpm)$"
|
||||
|
||||
@ -8,7 +8,7 @@ import datetime
|
||||
|
||||
def get_time(s):
|
||||
if 'fromisoformat' in dir(datetime.datetime):
|
||||
return datetime.datetime.fromisoformat(s)
|
||||
return datetime.datetime.fromisoformat(s.replace('Z', '+00:00'))
|
||||
else:
|
||||
return __import__('dateutil.parser').parser.parse(s)
|
||||
|
||||
@ -54,7 +54,7 @@ def get_author(name):
|
||||
return data
|
||||
|
||||
def get_changelog(owner, name):
|
||||
print('Reading releases of {} in {}'.format(owner, name), flush=True, file=sys.stderr)
|
||||
print('Reading releases of {1} in {0}'.format(owner, name), flush=True, file=sys.stderr)
|
||||
releases = api_get('repos/{}/{}/releases'.format(owner, name))
|
||||
releases = filter(lambda v: not v['draft'] and not v['prerelease'], releases)
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
VERSION=$1
|
||||
REALVERSION=`echo "$VERSION" | cut -d'-' -f1`
|
||||
@ -63,5 +63,5 @@ echo "" >> zjunet.spec
|
||||
echo "%post" >> zjunet.spec
|
||||
echo "/usr/share/zjunet/zjunet-postinst || true" >> zjunet.spec
|
||||
echo "" >> zjunet.spec
|
||||
../changelog.py rpm >> zjunet.spec
|
||||
|
||||
../../changelog.py rpm >> zjunet.spec
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user