Skip to content

Commit

Permalink
make checksums more concise, create tar archives for windows as well
Browse files Browse the repository at this point in the history
  • Loading branch information
lmaotrigine committed Nov 15, 2023
1 parent 30c3ee8 commit 814c841
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ jobs:
files: |
${{ steps.package.outputs.archive }}
${{ steps.package.outputs.checksumfile }}
${{ steps.package.outputs.tar_archive }}
${{ steps.package.outputs.tar_checksumfile }}
prerelease: ${{ steps.ref-type.outputs.value != 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 11 additions & 6 deletions bin/package
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,29 @@ if [[ "$OS" = windows-latest ]]; then
fi

echo "Copying release files..."
mkdir "$DIST"
cp "$EXECUTABLE" LICENSE README.md config.example.toml conf/nginx.conf conf/Caddyfile "$DIST"
mkdir -p "$DIST/staging"
cp "$EXECUTABLE" LICENSE README.md config.example.toml conf/nginx.conf conf/Caddyfile "$DIST/staging"

cd "$DIST"
echo "Creating release archive..."
case "$OS" in
ubuntu-latest | macos-latest)
ARCHIVE=$DIST/heartbeat-$VERSION-$TARGET.tar.xz
tar cJf "$ARCHIVE" ./*
shasum -a 256 "$ARCHIVE" > "$ARCHIVE".sha256
tar cJf "$ARCHIVE" staging/*
shasum -a 256 "$ARCHIVE" | cut -d' ' -f1 > "$ARCHIVE".sha256
echo "archive=$ARCHIVE" >> "$GITHUB_OUTPUT"
echo "checksumfile=$ARCHIVE.sha256" >> "$GITHUB_OUTPUT"
;;
windows-latest)
ARCHIVE=$DIST/heartbeat-$VERSION-$TARGET.zip
7z a "$ARCHIVE" ./*
certutil -hashfile "$ARCHIVE" SHA256 > "$ARCHIVE".sha256
TAR_ARCHIVE=$DIST/heartbeat-$VERSION-$TARGET.tar.xz
7z a "$ARCHIVE" staging/*
tar cJf "$TAR_ARCHIVE" staging/*
certutil -hashfile "$ARCHIVE" SHA256 | grep -o "[0-9a-f]\{64\}" > "$ARCHIVE".sha256
certutil -hashfile "$TAR_ARCHIVE" SHA256 | grep -o "[0-9a-f]\{64\}" > "$TAR_ARCHIVE".sha256
echo "archive=$(pwd -W)/heartbeat-$VERSION-$TARGET.zip" >> "$GITHUB_OUTPUT"
echo "tar_archive=$(pwd -W)/heartbeat-$VERSION-$TARGET.tar.xz" >> "$GITHUB_OUTPUT"
echo "checksumfile=$(pwd -W)/heartbeat-$VERSION-$TARGET.zip.sha256" >> "$GITHUB_OUTPUT"
echo "tar_checksumfile=$(pwd -W)/heartbeat-$VERSION-$TARGET.tar.xz.sha256" >> "$GITHUB_OUTPUT"
;;
esac

0 comments on commit 814c841

Please sign in to comment.