Skip to content

Commit abab2db

Browse files
vdyeldennington
authored andcommitted
release: build unsigned Ubuntu .deb package
- include `scalar` - build & upload unsigned .deb package Co-authored-by: Lessley Dennington <ldennington@github.com>
1 parent 89a7ed6 commit abab2db

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

.github/workflows/build-git-installers.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,3 +540,106 @@ jobs:
540540
git/.github/macos-installer/*.dmg
541541
git/.github/macos-installer/*.pkg
542542
# End build and sign Mac OSX installers
543+
544+
# Build unsigned Ubuntu package
545+
create-linux-unsigned-artifacts:
546+
runs-on: ubuntu-latest
547+
container:
548+
image: ubuntu:20.04 # security support until 04/02/2025, according to https://endoflife.date/ubuntu
549+
volumes:
550+
# override /__e/node20 because GitHub Actions uses a version that requires too-recent glibc, see "Install dependencies" below
551+
- /tmp:/__e/node20
552+
needs: prereqs
553+
steps:
554+
- name: Install dependencies
555+
run: |
556+
set -ex
557+
558+
# Prevent the dialog that asks interactively for the timezone
559+
export DEBIAN_FRONTEND=noninteractive
560+
export TZ=Etc/UTC
561+
562+
apt-get update -q
563+
apt-get install -y -q --no-install-recommends \
564+
build-essential \
565+
tcl tk gettext asciidoc xmlto \
566+
libcurl4-gnutls-dev libpcre2-dev zlib1g-dev libexpat-dev \
567+
curl ca-certificates
568+
569+
# Install a Node.js version that works in older Ubuntu containers (read: does not require very recent glibc)
570+
NODE_VERSION=v20.18.1 &&
571+
NODE_URL=https://unofficial-builds.nodejs.org/download/release/$NODE_VERSION/node-$NODE_VERSION-linux-x64-glibc-217.tar.gz &&
572+
curl -Lo /tmp/node.tar.gz $NODE_URL &&
573+
tar -C /__e/node20 -x --strip-components=1 -f /tmp/node.tar.gz
574+
575+
- name: Clone git
576+
uses: actions/checkout@v4
577+
with:
578+
path: git
579+
580+
- name: Build and create Debian package
581+
run: |
582+
set -ex
583+
584+
die () {
585+
echo "$*" >&2
586+
exit 1
587+
}
588+
589+
VERSION="${{ needs.prereqs.outputs.tag_version }}"
590+
591+
# Convert -rc to .rc to match GIT-VERSION-FILE behavior
592+
BUILD_VERSION=$(echo "${VERSION}" | sed 's/-rc/.rc/g')
593+
echo "$BUILD_VERSION" >git/version
594+
make -C git GIT-VERSION-FILE
595+
596+
ARCH="$(dpkg-architecture -q DEB_HOST_ARCH)"
597+
if test -z "$ARCH"; then
598+
die "Could not determine host architecture!"
599+
fi
600+
601+
PKGNAME="microsoft-git_$VERSION"
602+
PKGDIR="$(dirname $(pwd))/$PKGNAME"
603+
604+
rm -rf "$PKGDIR"
605+
mkdir -p "$PKGDIR"
606+
607+
DESTDIR="$PKGDIR" make -C git -j5 V=1 DEVELOPER=1 \
608+
USE_LIBPCRE=1 \
609+
USE_CURL_FOR_IMAP_SEND=1 NO_OPENSSL=1 \
610+
NO_CROSS_DIRECTORY_HARDLINKS=1 \
611+
ASCIIDOC8=1 ASCIIDOC_NO_ROFF=1 \
612+
ASCIIDOC='TZ=UTC asciidoc' \
613+
prefix=/usr/local \
614+
gitexecdir=/usr/local/lib/git-core \
615+
libexecdir=/usr/local/lib/git-core \
616+
htmldir=/usr/local/share/doc/git/html \
617+
install install-doc install-html
618+
619+
cd ..
620+
mkdir "$PKGNAME/DEBIAN"
621+
622+
# Based on https://packages.ubuntu.com/xenial/vcs/git
623+
cat >"$PKGNAME/DEBIAN/control" <<EOF
624+
Package: microsoft-git
625+
Version: $VERSION
626+
Section: vcs
627+
Priority: optional
628+
Architecture: $ARCH
629+
Depends: libcurl3-gnutls, liberror-perl, libexpat1, libpcre2-8-0, perl, perl-modules, zlib1g
630+
Maintainer: GitClient <gitclient@microsoft.com>
631+
Description: Git client built from the https://github.com/microsoft/git repository,
632+
specialized in supporting monorepo scenarios. Includes the Scalar CLI.
633+
EOF
634+
635+
dpkg-deb -Zxz --build "$PKGNAME"
636+
# Move Debian package for later artifact upload
637+
mv "$PKGNAME.deb" "$GITHUB_WORKSPACE"
638+
639+
- name: Upload artifacts
640+
uses: actions/upload-artifact@v4
641+
with:
642+
name: linux-artifacts
643+
path: |
644+
*.deb
645+
# End build unsigned Debian package

0 commit comments

Comments
 (0)