Add: Automatische Versionierung via VERSION-Datei
- VERSION-Datei als Single Source of Truth (startet bei 1.5.1) - CI liest Version aus Datei statt hardcoded - Patch-Version wird nach Deploy automatisch gebumpt - Commit mit [skip ci] verhindert Endlosschleife
This commit is contained in:
parent
7bebb7db9a
commit
9689af4d3a
4 changed files with 34 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
|||
stages:
|
||||
- build
|
||||
- deploy
|
||||
- bump-version
|
||||
|
||||
variables:
|
||||
INTERNAL_REGISTRY: "192.168.1.100:9080"
|
||||
|
|
@ -30,18 +31,19 @@ docker-build:
|
|||
EOF
|
||||
script:
|
||||
- |
|
||||
VERSION=$(cat VERSION 2>/dev/null || echo "0.0.0")
|
||||
|
||||
if [ "$CI_COMMIT_REF_NAME" = "main" ]; then
|
||||
TAG="main"
|
||||
VERSION="1.5.0"
|
||||
CHANNEL="stable"
|
||||
elif [ "$CI_COMMIT_REF_NAME" = "feature/nightly" ] || [ "$CI_COMMIT_REF_NAME" = "nightly" ]; then
|
||||
TAG="nightly"
|
||||
VERSION="1.5.0-nightly"
|
||||
VERSION="${VERSION}-nightly"
|
||||
CHANNEL="nightly"
|
||||
else
|
||||
CLEAN_TAG=$(echo "$CI_COMMIT_REF_NAME" | sed 's/\//-/g')
|
||||
TAG="$CLEAN_TAG"
|
||||
VERSION="1.5.0-dev"
|
||||
VERSION="${VERSION}-dev"
|
||||
CHANNEL="dev"
|
||||
fi
|
||||
|
||||
|
|
@ -101,3 +103,29 @@ deploy:
|
|||
-v /mnt/cache/appdata/dockge/container/jukebox/sounds/:/data/sounds:rw \
|
||||
"$DEPLOY_IMAGE"
|
||||
- docker ps --filter name="$CONTAINER_NAME" --format "ID={{.ID}} Status={{.Status}} Image={{.Image}}"
|
||||
|
||||
bump-version:
|
||||
stage: bump-version
|
||||
image: alpine:latest
|
||||
needs: [deploy]
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main" && $CI_COMMIT_MESSAGE !~ /\[skip ci\]/
|
||||
script:
|
||||
- apk add --no-cache git
|
||||
- |
|
||||
VERSION=$(cat VERSION)
|
||||
MAJOR=$(echo "$VERSION" | cut -d. -f1)
|
||||
MINOR=$(echo "$VERSION" | cut -d. -f2)
|
||||
PATCH=$(echo "$VERSION" | cut -d. -f3)
|
||||
NEXT_PATCH=$((PATCH + 1))
|
||||
NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}"
|
||||
|
||||
echo "$NEXT_VERSION" > VERSION
|
||||
echo "Bumped version: $VERSION -> $NEXT_VERSION"
|
||||
|
||||
git config user.name "GitLab CI"
|
||||
git config user.email "ci@adriahub.de"
|
||||
git remote set-url origin "http://oauth2:${CI_PUSH_TOKEN}@192.168.1.100:9080/${CI_PROJECT_PATH}.git"
|
||||
git add VERSION
|
||||
git commit -m "v${NEXT_VERSION} [skip ci]"
|
||||
git push origin HEAD:main
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ COPY web/package*.json ./
|
|||
RUN npm install --no-audit --no-fund
|
||||
COPY web/ .
|
||||
ARG VITE_BUILD_CHANNEL=stable
|
||||
ARG VITE_APP_VERSION=1.5.0
|
||||
ARG VITE_APP_VERSION=dev
|
||||
ENV VITE_BUILD_CHANNEL=$VITE_BUILD_CHANNEL
|
||||
ENV VITE_APP_VERSION=$VITE_APP_VERSION
|
||||
RUN npm run build
|
||||
|
|
|
|||
1
VERSION
Normal file
1
VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
1.5.1
|
||||
|
|
@ -92,7 +92,7 @@ export default function App() {
|
|||
return () => { es?.close(); clearTimeout(retryTimer); };
|
||||
}, []);
|
||||
|
||||
const version = (import.meta as any).env?.VITE_APP_VERSION ?? '1.5.0';
|
||||
const version = (import.meta as any).env?.VITE_APP_VERSION ?? 'dev';
|
||||
|
||||
// Listen for Electron auto-update events
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue