This commit introduces a GitHub action that is triggered on release creation, which creates the release tarball, compresses it, hashes it, signs it, and attaches all of those files to the release.
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: publish-release-artifacts
|
|
|
|
on:
|
|
release:
|
|
types:
|
|
- created
|
|
|
|
jobs:
|
|
publish-release-artifacts:
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Archive
|
|
env:
|
|
RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
|
|
run: |
|
|
# compute file name
|
|
export TAG=$(echo $GITHUB_REF | sed -n 's_^refs/tags/__p')
|
|
if [ -z "$TAG" ]; then
|
|
echo "action must be run on a tag. GITHUB_REF is not a tag: $GITHUB_REF"
|
|
exit 1
|
|
fi
|
|
export ZSTD_VERSION=zstd-$TAG
|
|
|
|
# archive
|
|
git archive $TAG \
|
|
--prefix $ZSTD_VERSION/ \
|
|
--format tar \
|
|
-o $ZSTD_VERSION.tar
|
|
|
|
# Do the rest of the work in a sub-dir so we can glob everything we want to publish.
|
|
mkdir artifacts/
|
|
mv $ZSTD_VERSION.tar artifacts/
|
|
cd artifacts/
|
|
|
|
# compress
|
|
zstd -k -19 $ZSTD_VERSION.tar
|
|
gzip -k -9 $ZSTD_VERSION.tar
|
|
|
|
rm $ZSTD_VERSION.tar
|
|
|
|
# hash
|
|
sha256sum $ZSTD_VERSION.tar.zst > $ZSTD_VERSION.tar.zst.sha256
|
|
sha256sum $ZSTD_VERSION.tar.gz > $ZSTD_VERSION.tar.gz.sha256
|
|
|
|
# sign
|
|
if [ -n "$RELEASE_SIGNING_KEY" ]; then
|
|
echo "$RELEASE_SIGNING_KEY" | gpg --import
|
|
gpg --armor --sign --sign-with signing@zstd.net --detach-sig --output $ZSTD_VERSION.tar.zst.sig $ZSTD_VERSION.tar.zst
|
|
gpg --armor --sign --sign-with signing@zstd.net --detach-sig --output $ZSTD_VERSION.tar.gz.sig $ZSTD_VERSION.tar.gz
|
|
fi
|
|
|
|
- name: Publish
|
|
uses: skx/github-action-publish-binaries@release-1.3
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
args: artifacts/*
|