diff options
author | kcgen <1557255+kcgen@users.noreply.github.com> | 2021-08-28 18:24:27 +0300 |
---|---|---|
committer | kcgen <1557255+kcgen@users.noreply.github.com> | 2021-08-28 21:35:58 +0300 |
commit | 30d8752ac518182b83af945b3dd372eb4fc9b08d (patch) | |
tree | 8176e3c3b33d81690f7034cd42507033e90d3e0e | |
parent | 4084e3dd9aa4225dceced6659f2e85b7d1b22afb (diff) |
Stop versioning releases using GitHub tag handlingv0.77.1
Currently the release string embedded in the sources is populated
using the "git describe --abbrev" command, written into a VERSION
text file that's then compiled into the sources.
Unfortunately this is unreliable and the latest isn't registered
in GitHub and instead the sources are built using the prior
tag (0.77.0 in this case).
Hours have been wasted attempting to get the latest
tag recognized. This is despite pushing the tag to GitHub
and using git's tag-following feature.
- Tag the kc/release-0.77.1 branch HEAD (failed - used 0.77.0)
- Tag the release/0.77.x branch HEAD (failed - used 0.77.0)
- Tag the master branch after HEAD (failed - used 0.77.0)
- Tag the kc/release-0.77.1 branch base (failed - used 0.77.0)
- Tag the release/0.77.x branch base (failed - used 0.77.0)
GitHub's action logs show:
++ git describe --abbrev=0
+ export VERSION=v0.77.0
+ VERSION=v0.77.0
+ echo VERSION=v0.77.0
This is despite GitHub's own action description showing the
v0.77.1 tag instead of the branch name to label the action.
This is the second time this has caused significant issues
and wasted effort - and (due to whatever's happening on
GitHub) has become a form of technical debt.
-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" |