From 58aa8a5e0cfcc9470c6293ea198a71f9cc416f3d Mon Sep 17 00:00:00 2001 From: rofl0r Date: Thu, 2 Dec 2021 20:02:08 +0000 Subject: [PATCH] CI: automatically build release tarball after a tag is pushed, and "create release from tag" is clicked, CI will now create an xz-compressed release tarball, containing all sources and submodules (if used). closes #582 --- .github/workflows/build_release.yml | 50 +++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/build_release.yml diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml new file mode 100644 index 00000000..8429af71 --- /dev/null +++ b/.github/workflows/build_release.yml @@ -0,0 +1,50 @@ +name: Build Source Release + +# Trigger whenever a release is created +on: + release: + types: + - created + +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + submodules: true + + - name: archive + id: archive + run: | + VERSION=${{ github.event.release.tag_name }} + PKGNAME="capstone-$VERSION" + SHASUM=$PKGNAME.tar.xz.sha256 + mkdir -p /tmp/$PKGNAME + mv * /tmp/$PKGNAME + mv /tmp/$PKGNAME . + TARBALL=$PKGNAME.tar.xz + tar cJf $TARBALL $PKGNAME + sha256sum $TARBALL > $SHASUM + echo "::set-output name=tarball::$TARBALL" + echo "::set-output name=shasum::$SHASUM" + - name: upload tarball + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./${{ steps.archive.outputs.tarball }} + asset_name: ${{ steps.archive.outputs.tarball }} + asset_content_type: application/gzip + + - name: upload shasum + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./${{ steps.archive.outputs.shasum }} + asset_name: ${{ steps.archive.outputs.shasum }} + asset_content_type: text/plain