Skip to content

Commit

Permalink
feat(actions): add support for debian packaging (#696)
Browse files Browse the repository at this point in the history
Signed-off-by: Boaz Sade <[email protected]>

Signed-off-by: Boaz Sade <[email protected]>
  • Loading branch information
boazsade authored Jan 18, 2023
1 parent 9536c0a commit be74fa0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,28 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Configure
run: |
apt update && apt install -y debhelper
- name: Build artifacts
run: |
# Work around https://github.com/actions/checkout/issues/766
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git describe --always --tags ${{ github.sha }}
./tools/release.sh
# once the build is over, we want to generate a Debian package
./tools/packaging/generate_debian_package.sh build-opt/dragonfly-x86_64
- name: Save artifacts
run: |
# place all artifacts at the same location
mkdir -p results-artifacts
mv build-opt/dragonfly-*tar.gz results-artifacts
mv dragonfly_*.deb results-artifacts
- name: Upload
uses: actions/upload-artifact@v3
with:
name: dragonfly-amd64
path: build-opt/dragonfly-*tar.gz

path: results-artifacts/*
publish_release:
runs-on: ubuntu-latest
needs: [build-native, build-qemu]
Expand Down
19 changes: 18 additions & 1 deletion tools/packaging/generate_changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,30 @@ THIS_DIR=$(dirname ${SCRIPT_ABS_PATH})
GIT_DIR=$1
PACKGE_DIR=${THIS_DIR}/debian
CHANGE_LOG=${PACKGE_DIR}/changelog

cd ${GIT_DIR}
git config --global --add safe.directory ${GIT_DIR}
has_tags=$(git tag -l v* | wc -l 2>/dev/null)
if [ "$has_tags" = "" -o "$has_tags" = "0" ]; then
git fetch --all --tags || {
echo "failed to fetch tags, cannot build changelog file"
exit 1
}
fi

>${CHANGE_LOG}
prevtag=v0.2.0
pkgname=`cat ${PACKGE_DIR}/control | grep '^Package: ' | sed 's/^Package: //'`
git tag -l v* | sort -V | while read tag; do
(echo "$pkgname (${tag#v}) unstable; urgency=low"; git log --pretty=format:' * %s' $prevtag..$tag; git log --pretty='format:%n%n -- %aN <%aE> %aD%n%n' $tag^..$tag) | cat - ${CHANGE_LOG} | sponge ${CHANGE_LOG}
prevtag=$tag
done
if [ -f ${CHANGE_LOG} ]; then
haslnes=$(wc -l ${CHANGE_LOG} 2>/dev/null | awk '{print $1}')
if [ "$haslnes" = "" ]; then
echo "empty file ${CHANGE_LOG}, failed to generate changelog"
exit 1
fi
else
echo "failed to generate ${CHANGE_LOG}"
exit 1
fi

0 comments on commit be74fa0

Please sign in to comment.