Skip to content

Commit

Permalink
build: Updates to better name packages
Browse files Browse the repository at this point in the history
Signed-off-by: Gerard Hickey <[email protected]>
  • Loading branch information
hickey committed Oct 8, 2023
1 parent cd9f90f commit 4e36cc0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-meshchat-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: meshchat
path: meshchat_*
path: |
meshchat_*.ipk
VERSION
17 changes: 16 additions & 1 deletion package/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,34 @@

IPK_DIR=$1

if [[ "$GITHUB_REF_TYPE" == 'tag' ]]; then
if [[ "${GITHUB_REF_TYPE}" == 'tag' ]]; then
# ideally should only get version tags (i.e. 'v' followed by a number)
if [[ "${GITHUB_REF_NAME}" =~ ^v[0-9].* ]]; then
version="${GITHUB_REF_NAME#v}"
fi
elif [[ -n "${CI_COMMIT_TAG}" ]]; then
# ideally should only get version tags (i.e. 'v' followed by a number)
if [[ "${CI_COMMIT_TAG}" =~ ^v[0-9].* ]]; then
version="${CI_COMMIT_TAG#v}"
fi
else
# branch gets date code-branch_name-commit
date=$(date +%Y%m%d)
branch=$(git rev-parse --abbrev-ref HEAD)
# maybe a detached head, so check common vars for branch name
if [[ -n "${CI_COMMIT_REF_NAME}" ]]; then
branch="${CI_COMMIT_REF_NAME}"
elif [[ -n "${GITHUB_REF_NAME}" ]]; then
branch="${GITHUB_REF_NAME}"
fi
commit=$(git rev-parse --short HEAD)
version="${date}-${branch}-${commit}"
fi

# write the version to a VERSION file
echo "${version}" > VERSION
echo "Updating code references to version ${version}"

sed -i "s/^Version:.*/Version: $version/" $IPK_DIR/CONTROL/control

# Update the version in meshchatconfig.lua if present
Expand Down

0 comments on commit 4e36cc0

Please sign in to comment.