Skip to content

Commit 86ebe4f

Browse files
committed
Publish packages
1 parent 8a5cb3a commit 86ebe4f

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,37 @@ on:
44
workflow_dispatch:
55

66
jobs:
7+
create-release:
8+
runs-on: ubuntu-slim
9+
10+
outputs:
11+
version: ${{ steps.get-version.outputs.version }}
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v6
16+
with:
17+
# fetch full history + tags
18+
fetch-depth: 0
19+
20+
- name: Get version
21+
id: get-version
22+
run: |
23+
VERSION=$(ci/git_version.sh | xargs)
24+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
25+
26+
- name: Create release
27+
env:
28+
GH_TOKEN: ${{ github.token }}
29+
VERSION: ${{ steps.get-version.outputs.version }}
30+
run: |
31+
gh release create ${VERSION} \
32+
--draft \
33+
--title "mrbind ${VERSION}"
34+
735
build-linux:
36+
needs:
37+
- create-release
838
runs-on: ${{ matrix.runner }}
939
container:
1040
image: almalinux:8
@@ -83,3 +113,25 @@ jobs:
83113
echo g++ > examples/cxx.txt
84114
examples/c/run.sh
85115
PYTHON=python3.8 examples/python/run.sh
116+
117+
- name: Create package
118+
run: |
119+
dnf install -y zip
120+
mkdir mrbind
121+
mv build/mrbind{,_gen_c,_gen_csharp} mrbind/
122+
mv llvm-out/lib/clang/22 mrbind/resource-dir
123+
zip -r mrbind-linux-$(uname -m).zip mrbind/
124+
125+
- name: Upload package
126+
env:
127+
GH_TOKEN: ${{ github.token }}
128+
VERSION: ${{ needs.create-release.outputs.version }}
129+
run: |
130+
# TODO: use a ready-made universal GitHub action
131+
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
132+
dnf install -y gh
133+
# fix git permissions
134+
export HOME=${RUNNER_TEMP}
135+
git config --global --add safe.directory '*'
136+
# upload package
137+
gh release upload ${VERSION} mrbind-linux-$(uname -m).zip --clobber

ci/git_version.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if tag=$(git describe --tags --abbrev=0 --match 'v*' 2>/dev/null); then
5+
count=$(git rev-list --count "${tag}..HEAD")
6+
else
7+
# no reachable version tag, fall back to the CMake default (0.0.0).
8+
tag="v0.0.0"
9+
count=$(git rev-list --count HEAD 2>/dev/null || echo 0)
10+
fi
11+
12+
printf '%s-%s\n' "$tag" "$count"

0 commit comments

Comments
 (0)