Skip to content

Commit 4c57953

Browse files
committed
Upload release asset during CI workflow
1 parent 3460261 commit 4c57953

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,16 @@ jobs:
3636
with:
3737
name: msgstream-tarball
3838
- run: script/test-release.sh msgstream-*.tgz
39+
upload-package:
40+
needs: test-package
41+
runs-on: ubuntu-latest
42+
permissions:
43+
contents: write
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/download-artifact@v4
49+
with:
50+
name: msgstream-tarball
51+
- run: script/upload-package.sh msgstream-*.tgz

script/parse-validate-version.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ if [ "$PUBLISH_VERSION" != "$PACKAGE_VERSION" ]; then
1212
echo "Version in GITHUB_REF '$GITHUB_REF' does not match package.json version $PACKAGE_VERSION"
1313
exit 1
1414
fi
15+
16+
# We now know this is the same
17+
VERSION="$PACKAGE_VERSION"

script/upload-package.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
set -e
4+
set -x
5+
6+
# Validates and sets VERSION
7+
. script/parse-validate-version.sh
8+
9+
PKG="${1:?Usage: $0 <msgstream-x.x.x.tgz>}"
10+
11+
if [ "$(basename $PKG)" != "msgstream-$VERSION.tgz" ]; then
12+
echo "Unexpected tarball '$PKG' given to $0"
13+
exit 1
14+
fi
15+
16+
gh release upload "v$VERSION" "$PKG#Source Package"

0 commit comments

Comments
 (0)