From 2f535b8f747eea5c3336ecf20a3ecc9c0d523f62 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Mon, 9 Jun 2025 12:52:43 -0400 Subject: [PATCH] chore(ci): update tarball workflow in GitHub Actions --- .github/workflows/tarball.yml | 59 +++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index b6e6e949..91597f3b 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -4,42 +4,47 @@ on: branches: [ master ] workflow_dispatch: +jobs: + dist: + runs-on: ubuntu-latest + steps: +name: snapshot-dist-tarball +on: + push: + branches: [ master ] + workflow_dispatch: + jobs: dist: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 # git describe needs full history + with: {fetch-depth: 0} - - name: Install autotools - run: sudo apt-get update && sudo apt-get -y install autoconf automake libtool texinfo libltdl-dev texlive - - - name: Stamp snapshot version into configure.ac + - name: Compute snapshot VERSION + id: ver run: | - VERSION="$(git describe --tags --long --match 'v[0-9]*' | sed -e 's/^v//' -e 's/-/.dev./' -e 's/-/+g/')" - echo "VERSION=$VERSION" >> "$GITHUB_ENV" + DESC=$(git describe --long --tags --match 'v[0-9]*' 2>/dev/null || echo "") + VERSION=$(echo "$DESC" | sed -E 's/^v//; s/-([0-9]+)-g/\.dev.\1+g/') + if [[ -z "$VERSION" || "$VERSION" == "$DESC" ]]; then + VERSION="3.5.1-dev.0+g$(git rev-parse --short HEAD)" + fi + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" - # 1) AC_INIT second argument - # AC_INIT([libffi],[],[bug-address]) - sed -E -i "s/^(AC_INIT\(\[libffi\],\s*\[)[^]]+/\1$VERSION/" configure.ac + - name: Patch configure.ac + run: | + sed -Ei "s/^(AC_INIT\(\[libffi\],\s*\[)[^]]+/\1${VERSION}/" configure.ac + sed -Ei "s/^(FFI_VERSION_STRING=\")[^\"]+/\1${VERSION}/" configure.ac - # 2) FFI_VERSION_STRING="..." - sed -E -i "s/^(FFI_VERSION_STRING=\")[^\"]+/\1$VERSION/" configure.ac - - - name: autogen - run: ./autogen.sh - - - name: Configure - run: ./configure - - - name: Build dist tarball - run: make dist + - run: autoreconf -fi + - run: ./configure + - run: make dist # produces libffi-${VERSION}.tar.gz - name: Create (or update) “snapshots” release uses: softprops/action-gh-release@v2 - with: - tag_name: snapshots - prerelease: true - body: "Snapshot built from ${{ github.sha }}" - files: libffi-${{ env.VERSION }}.tar.* + with: + tag_name: snapshots + prerelease: true + body: "Nightly snapshot built from ${{ github.sha }}" + files: libffi-${{ env.VERSION }}.tar.*