diff options
-rw-r--r-- | .github/workflows/linux.yml | 11 | ||||
-rw-r--r-- | .github/workflows/macos.yml | 11 | ||||
-rw-r--r-- | .github/workflows/windows.yml | 11 | ||||
-rw-r--r-- | .version | 2 | ||||
-rwxr-xr-x | scripts/version.sh | 21 |
5 files changed, 36 insertions, 20 deletions
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 383140324..f7f9b90e5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -189,10 +189,8 @@ jobs: - name: Inject version string run: | - set -x + scripts/version.sh >> $GITHUB_ENV git fetch --prune --unshallow - export VERSION=$(git describe --abbrev=0) - echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Setup release build run: | @@ -306,13 +304,12 @@ jobs: run: | set +x git fetch --unshallow - VERSION=$(git describe --abbrev=0) - echo "VERSION=$VERSION" >> $GITHUB_ENV NEWEST_TAG=$(git describe --abbrev=0) - git log "$NEWEST_TAG..HEAD" > changelog-$VERSION.txt + git log "$NEWEST_TAG..HEAD" > changelog.txt + scripts/version.sh >> $GITHUB_ENV - uses: actions/upload-artifact@v2 with: # Keep exactly this artifact name; it's being used to propagate # version info via GitHub REST API name: changelog-${{ env.VERSION }}.txt - path: changelog-${{ env.VERSION }}.txt + path: changelog.txt diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 8cd99c801..d7679908b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -214,10 +214,8 @@ jobs: - name: Inject version string run: | - set -x + scripts/version.sh >> $GITHUB_ENV git fetch --prune --unshallow - export VERSION=$(git describe --abbrev=0) - echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Setup release build run: | @@ -346,13 +344,12 @@ jobs: run: | set +x git fetch --unshallow - VERSION=$(git describe --abbrev=0) - echo "VERSION=$VERSION" >> $GITHUB_ENV NEWEST_TAG=$(git describe --abbrev=0) - git log "$NEWEST_TAG..HEAD" > changelog-$VERSION.txt + git log "$NEWEST_TAG..HEAD" > changelog.txt + scripts/version.sh >> $GITHUB_ENV - uses: actions/upload-artifact@v2 with: # Keep exactly this artifact name; it's being used to propagate # version info via GitHub REST API name: changelog-${{ env.VERSION }}.txt - path: changelog-${{ env.VERSION }}.txt + path: changelog.txt diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d353da0a5..a34356c0d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -131,10 +131,10 @@ jobs: run: | set -x git fetch --prune --unshallow - export VERSION=$(git describe --abbrev=0) + eval $(scripts/version.sh) + echo "VERSION=$VERSION" >> $GITHUB_ENV # inject version based on vcs sed -i "s|DOSBOX_DETAILED_VERSION \"git\"|DOSBOX_DETAILED_VERSION \"$VERSION\"|" src/platform/visualc/config.h - echo "VERSION=$VERSION" >> $GITHUB_ENV # overwrite .conf file branding for release build sed -i "s|CONF_SUFFIX \"-staging-git\"|CONF_SUFFIX \"-staging\"|" src/platform/visualc/config.h @@ -247,13 +247,12 @@ jobs: run: | set +x git fetch --unshallow - VERSION=$(git describe --abbrev=0) - echo "VERSION=$VERSION" >> $GITHUB_ENV NEWEST_TAG=$(git describe --abbrev=0) - git log "$NEWEST_TAG..HEAD" > changelog-$VERSION.txt + git log "$NEWEST_TAG..HEAD" > changelog.txt + scripts/version.sh >> $GITHUB_ENV - uses: actions/upload-artifact@v2 with: # Keep exactly this artifact name; it's being used to propagate # version info via GitHub REST API name: changelog-${{ env.VERSION }}.txt - path: changelog-${{ env.VERSION }}.txt + path: changelog.txt diff --git a/.version b/.version new file mode 100644 index 000000000..450ea41ae --- /dev/null +++ b/.version @@ -0,0 +1,2 @@ +v0.77.1 + diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100755 index 000000000..3053b9248 --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2021-2021 kcgen <kcgen@users.noreply.github.com> +# +# version.sh - Print the currect software release an identifier + +set -euo pipefail + +vfile=".version" + +if [[ ! -f "$vfile" ]]; then + basedir=$(git rev-parse --show-toplevel) # or fail + vfile="$basedir/$vfile" +fi + +release=$(cat "$vfile") # or fail +identifier=$(git rev-parse --short=5 HEAD 2>/dev/null || echo norepo-source) + +echo "VERSION=$release-$identifier" |