chore(ci): update tarball workflow in GitHub Actions

This commit is contained in:
Anthony Green 2025-06-09 12:52:43 -04:00
parent 172bfb41f4
commit 2f535b8f74

View File

@ -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],[<old>],[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.*