Skip to content

Commit 0f9a3cf

Browse files
authored
release: fix tarball signing and Debian compression (#1009)
While we added PGP signatures for tarballs in 7baac73, we did not notice that, while ESRP returns a file with the tar.gz extension, it is actually the signature file, not the tarball itself. Correct with this change and validate tarball moving forward so it doesn't happen again! Additionally, a user reported in #997 that the latest GCM Debian package didn't work on Debian distributions. It appears that the version of dpkg that ships with Debian [does not support zstd compression](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=892664). Enforcing xz compression resolves the issue. Finally, this provided an opportunity to clean up some unused variables in pack.sh for Linux and to ensure we check the architecture is found before attemping to use the ARCH variable. These changes were validated with [this successful test run](https://github.com/ldennington/git-credential-manager/actions/runs/3795232469) in my fork.
2 parents 233ac29 + 34c0426 commit 0f9a3cf

File tree

2 files changed

+39
-18
lines changed

2 files changed

+39
-18
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ jobs:
384384
- name: Upload artifacts
385385
uses: actions/upload-artifact@v3
386386
with:
387-
name: tmp.linux-build
387+
name: linux-build
388388
path: |
389389
linux-build
390390
@@ -399,7 +399,11 @@ jobs:
399399
- name: Download artifacts
400400
uses: actions/download-artifact@v3
401401
with:
402-
name: tmp.linux-build
402+
name: linux-build
403+
404+
- name: Remove symbols
405+
run: |
406+
rm tar/*symbols*
403407
404408
- uses: azure/login@v1
405409
with:
@@ -423,6 +427,12 @@ jobs:
423427
run: |
424428
python .github/run_esrp_signing.py deb $env:LINUX_KEY_CODE $env:LINUX_OP_CODE
425429
python .github/run_esrp_signing.py tar $env:LINUX_KEY_CODE $env:LINUX_OP_CODE
430+
431+
- name: Re-name tarball signature file
432+
shell: bash
433+
run: |
434+
signaturepath=$(find signed/*.tar.gz)
435+
mv "$signaturepath" "${signaturepath%.tar.gz}.asc"
426436
427437
- name: Upload signed tarball and Debian package
428438
uses: actions/upload-artifact@v3
@@ -624,19 +634,27 @@ jobs:
624634
- os: ubuntu-latest
625635
artifact: linux-sign
626636
command: git-credential-manager
637+
description: debian
638+
- os: ubuntu-latest
639+
artifact: linux-build
640+
command: git-credential-manager
641+
description: tarball
627642
- os: macos-latest
628643
artifact: osx-x64-sign
629644
command: git-credential-manager
645+
description: osx-x64
630646
- os: windows-latest
631647
artifact: win-sign
632648
# Even when a standalone GCM version is installed, GitHub actions
633649
# runners still only recognize the version bundled with Git for
634650
# Windows due to its placement on the PATH. For this reason, we use
635651
# the full path to our installation to validate the Windows version.
636652
command: "$PROGRAMFILES (x86)/Git Credential Manager/git-credential-manager.exe"
653+
description: windows
637654
- os: ubuntu-latest
638655
artifact: dotnet-tool-sign
639656
command: git-credential-manager
657+
description: dotnet-tool
640658
runs-on: ${{ matrix.component.os }}
641659
needs: [ osx-sign, win-sign, linux-sign, dotnet-tool-sign ]
642660
steps:
@@ -654,7 +672,7 @@ jobs:
654672
name: ${{ matrix.component.artifact }}
655673

656674
- name: Install Windows
657-
if: contains(matrix.component.os, 'windows')
675+
if: contains(matrix.component.description, 'windows')
658676
shell: pwsh
659677
run: |
660678
$exePaths = Get-ChildItem -Path ./signed/*.exe | %{$_.FullName}
@@ -663,22 +681,30 @@ jobs:
663681
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART"
664682
}
665683
666-
- name: Install Linux
667-
if: contains(matrix.component.os, 'ubuntu') && contains(matrix.component.artifact, 'linux')
684+
- name: Install Linux (Debian package)
685+
if: contains(matrix.component.description, 'debian')
668686
run: |
669687
debpath=$(find ./*.deb)
670688
sudo apt install $debpath
671689
"${{ matrix.component.command }}" configure
690+
691+
- name: Install Linux (tarball)
692+
if: contains(matrix.component.description, 'tarball')
693+
run: |
694+
# Ensure we find only the source tarball, not the symbols
695+
tarpath=$(find ./tar -name '*[[:digit:]].tar.gz')
696+
tar -xvf $tarpath -C /usr/local/bin
697+
"${{ matrix.component.command }}" configure
672698
673699
- name: Install macOS
674-
if: contains(matrix.component.os, 'macos')
700+
if: contains(matrix.component.description, 'osx-x64')
675701
run: |
676702
# Only validate x64, given arm64 agents are not available
677703
pkgpath=$(find ./*.pkg)
678704
sudo installer -pkg $pkgpath -target /
679705
680706
- name: Install .NET tool
681-
if: contains(matrix.component.os, 'ubuntu') && contains(matrix.component.artifact, 'dotnet-tool')
707+
if: contains(matrix.component.description, 'dotnet-tool')
682708
run: |
683709
nupkgpath=$(find ./*.nupkg)
684710
dotnet tool install -g --add-source $(dirname "$nupkgpath") git-credential-manager
@@ -787,6 +813,7 @@ jobs:
787813
uploadDirectoryToRelease('osx-payload-and-symbols'),
788814
789815
// Upload Linux artifacts
816+
uploadDirectoryToRelease('linux-build/tar'),
790817
uploadDirectoryToRelease('linux-sign'),
791818
792819
// Upload .NET tool package

src/linux/Packaging.Linux/pack.sh

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ OUT="$ROOT/out"
1212
PROJ_OUT="$OUT/linux/Packaging.Linux"
1313
INSTALLER_SRC="$SRC/osx/Installer.Mac"
1414

15-
# Product information
16-
IDENTIFIER="com.microsoft.gitcredentialmanager"
17-
INSTALL_LOCATION="/usr/local/share/gcm-core"
18-
1915
# Parse script arguments
2016
for i in "$@"
2117
do
@@ -51,6 +47,10 @@ fi
5147

5248
ARCH="`dpkg-architecture -q DEB_HOST_ARCH`"
5349

50+
if test -z "$ARCH"; then
51+
die "Could not determine host architecture!"
52+
fi
53+
5454
TAROUT="$PROJ_OUT/$CONFIGURATION/tar/"
5555
TARBALL="$TAROUT/gcm-linux_$ARCH.$VERSION.tar.gz"
5656
SYMTARBALL="$TAROUT/gcm-linux_$ARCH.$VERSION-symbols.tar.gz"
@@ -60,10 +60,6 @@ DEBROOT="$DEBOUT/root"
6060
DEBPKG="$DEBOUT/gcm-linux_$ARCH.$VERSION.deb"
6161
mkdir -p "$DEBROOT"
6262

63-
if test -z "$ARCH"; then
64-
die "Could not determine host architecture!"
65-
fi
66-
6763
# Set full read, write, execute permissions for owner and just read and execute permissions for group and other
6864
echo "Setting file permissions..."
6965
/bin/chmod -R 755 "$PAYLOAD" || exit 1
@@ -114,8 +110,6 @@ Description: Cross Platform Git Credential Manager command line utility.
114110
For more information see https://aka.ms/gcm
115111
EOF
116112

117-
mkdir -p "$INSTALL_TO" "$LINK_TO"
118-
119113
# Copy all binaries and shared libraries to target installation location
120114
cp -R "$PAYLOAD"/* "$INSTALL_TO" || exit 1
121115

@@ -131,6 +125,6 @@ if [ ! -f "$LINK_TO/git-credential-manager-core" ]; then
131125
"$LINK_TO/git-credential-manager-core" || exit 1
132126
fi
133127

134-
dpkg-deb --build "$DEBROOT" "$DEBPKG" || exit 1
128+
dpkg-deb -Zxz --build "$DEBROOT" "$DEBPKG" || exit 1
135129

136130
echo $MESSAGE

0 commit comments

Comments
 (0)