From b6374b09852082fcdbc157b71e369e0ad9b762d5 Mon Sep 17 00:00:00 2001 From: Christian Garbs Date: Sun, 25 Feb 2024 22:06:39 +0100 Subject: [PATCH] automatically attach tarball to GitHub releases When a GitHub release is created, automatically run `make dist` and upload the resulting .tar.gz as a release artifact. --- .github/workflows/release.yaml | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..91ee744 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,42 @@ +# this workflow handles new releases and adds artifacts + +name: Release +on: + release: + types: + - published + +permissions: read-all + +jobs: + release-tar-gz: + name: Release .tar.gz + + runs-on: ubuntu-latest + + permissions: + contents: write # needed to upload the artifact + + steps: + - uses: actions/checkout@v4 + - name: build .tar.gz using make dist + run: | + # configure and determine build version + ./configure + + # save build version for later + build_version="$(sed -n '/^VERSION/s/.*:= //p' config.mk)" + echo "build version is $build_version" + + # build the tarball + make dist + + # determine archive name for the next step + archive_name="../gbsplay-$build_version.tar.gz" + echo "archive name is $archive_name" + ls -l "$archive_name" || exit 1 + echo "archive_name=$archive_name" >> "$GITHUB_ENV" + - name: upload .tar.gz artifact + uses: softprops/action-gh-release@v1 + with: + files: ../${{ env.archive_name }}