Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/dist-tarball.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: dist-tarball
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
paths: [ .github/workflows/dist-tarball.yml, meson.build ]

jobs:
dist-tarball:
runs-on: ubuntu-26.04-arm

steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Setup
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y meson
echo "/usr/lib/llvm-21/bin" >> $GITHUB_PATH

- name: meson setup
run: |
meson setup --cross-file=./llvm.ini build

- name: meson dist
run: |
meson dist -C build

- name: Query version
run: |
meson introspect --projectinfo build | jq -r '"VERSION=\(.["version"])"' >> $GITHUB_ENV

- uses: actions/upload-artifact@v7
with:
archive: false
path: build/meson-dist/avd-fw-${{ env.VERSION }}.tar.xz
5 changes: 4 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ project('avd-fw', 'c',
license: 'MIT',
license_files: 'LICENSE',
meson_version: '>=1.4.0',
version: '0.1',
version: run_command('version.sh', 'get-vcs', check: true).stdout().strip(),
)

# Provide a version for `meson dist` tarballs
meson.add_dist_script('version.sh', 'set-dist', meson.project_version())

# cross files are needed as those are the only way to set default compiler
# and specify the host arch
if not meson.is_cross_build()
Expand Down
15 changes: 15 additions & 0 deletions version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

if [ "$1" = "get-vcs" ]; then
GIT_DIR="${MESON_SOURCE_ROOT}"/.git
if [ ! -e "${GIT_DIR}" ]; then
echo "Tarball either not created with \`meson dist\` or otherwise missing \"${GIT_DIR}\"."
exit 1
fi
git --git-dir "$MESON_SOURCE_ROOT"/.git describe --always --dirty
elif [ "$1" = "set-dist" ]; then
$MESONREWRITE --sourcedir="$MESON_PROJECT_DIST_ROOT" kwargs set project / version "$2"
else
echo "$0 is expected to be executed by meson with 'get-vcs' or 'set-dist ...' as command"
exit 1
fi