Skip to content

Commit e280137

Browse files
committed
WIP
1 parent 9406cc0 commit e280137

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,28 @@ on:
66
jobs:
77
create-release:
88
runs-on: ubuntu-slim
9+
10+
outputs:
11+
version: ${{ steps.get-version.outputs.version }}
12+
913
steps:
1014
- name: Checkout
1115
uses: actions/checkout@v6
1216

17+
- name: Get version
18+
id: get-version
19+
run: |
20+
VERSION=$(ci/git_version.sh | xargs)
21+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
22+
1323
- name: Create release
1424
env:
1525
GH_TOKEN: ${{ github.token }}
26+
VERSION: ${{ steps.get-version.outputs.version }}
1627
run: |
17-
gh release create v0.0.1-pr \
28+
gh release create ${VERSION} \
1829
--draft \
19-
--title "mrbind v0.0.1-pr"
30+
--title "mrbind ${VERSION}"
2031
2132
build-linux:
2233
needs:
@@ -111,6 +122,7 @@ jobs:
111122
- name: Upload package
112123
env:
113124
GH_TOKEN: ${{ github.token }}
125+
VERSION: ${{ jobs.create-version.outputs.version }}
114126
run: |
115127
# TODO: use a ready-made universal GitHub action
116128
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
@@ -119,4 +131,4 @@ jobs:
119131
export HOME=${RUNNER_TEMP}
120132
git config --global --add safe.directory '*'
121133
# upload package
122-
gh release upload v0.0.1-pr mrbind-linux-$(uname -m).zip --clobber
134+
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)