| 1 |
name: snapshot-dist-tarball |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: [ master ] |
| 5 |
workflow_dispatch: |
| 6 |
|
| 7 |
jobs: |
| 8 |
dist: |
| 9 |
runs-on: ubuntu-latest |
| 10 |
steps: |
| 11 |
- name: Install tools |
| 12 |
run: | |
| 13 |
sudo apt update |
| 14 |
sudo apt install texlive texinfo autoconf automake libtool libltdl-dev |
| 15 |
|
| 16 |
- uses: actions/checkout@v4 |
| 17 |
with: {fetch-depth: 0} |
| 18 |
|
| 19 |
- name: Compute snapshot VERSION |
| 20 |
id: ver |
| 21 |
run: | |
| 22 |
DESC=$(git describe --long --tags --match 'v[0-9]*' 2>/dev/null || echo "") |
| 23 |
VERSION=$(echo "$DESC" | sed -E 's/^v//; s/-([0-9]+)-g/\.\1+g/') |
| 24 |
if [[ -z "$VERSION" || "$VERSION" == "$DESC" ]]; then |
| 25 |
VERSION="3.5.1-dev.0+g$(git rev-parse --short HEAD)" |
| 26 |
fi |
| 27 |
echo "VERSION=$VERSION" >> "$GITHUB_ENV" |
| 28 |
echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 29 |
|
| 30 |
- name: Patch configure.ac |
| 31 |
run: | |
| 32 |
sed -Ei "s/^(AC_INIT\(\[libffi\],\s*\[)[^]]+/\1${VERSION}/" configure.ac |
| 33 |
sed -Ei "s/^(FFI_VERSION_STRING=\")[^\"]+/\1${VERSION}/" configure.ac |
| 34 |
|
| 35 |
- run: autoreconf -fi |
| 36 |
- run: ./configure |
| 37 |
- run: make dist # produces libffi-${VERSION}.tar.gz |
| 38 |
|
| 39 |
- name: Wipe old snapshot assets |
| 40 |
uses: mknejp/delete-release-assets@v1 |
| 41 |
with: |
| 42 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 43 |
tag: snapshots # ← whatever tag your nightly release uses |
| 44 |
fail-if-no-assets: false |
| 45 |
assets: | |
| 46 |
libffi-*.tar.* |
| 47 |
libffi-*.zip |
| 48 |
|
| 49 |
- name: Create (or update) “snapshots” release |
| 50 |
uses: softprops/action-gh-release@v2 |
| 51 |
with: |
| 52 |
tag_name: snapshots |
| 53 |
prerelease: true |
| 54 |
body: "Snapshot built from ${{ github.sha }}" |
| 55 |
files: libffi-${{ env.VERSION }}.tar.* |