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