fix(versioning): move version bumping to CI build time
All checks were successful
Build MapleDeploy Coolify Image / build (push) Successful in 43s
All checks were successful
Build MapleDeploy Coolify Image / build (push) Successful in 43s
Version was never bumped because git rebase doesn't run pre-commit hooks. CI now appends a YYYYMMDDHHmm timestamp to the upstream base version and injects it into the Docker image via build arg.
This commit is contained in:
parent
0c9c3f611a
commit
bfb5e84c9a
2 changed files with 14 additions and 1 deletions
|
|
@ -23,7 +23,9 @@ jobs:
|
|||
- name: Get version
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(sed -n "s/.*'version' => '\([^']*\)'.*/\1/p" config/constants.php)
|
||||
BASE_VERSION=$(sed -n "s/.*'version' => '\([^']*\)'.*/\1/p" config/constants.php)
|
||||
TIMESTAMP=$(date -u +%Y%m%d%H%M)
|
||||
VERSION="${BASE_VERSION}.${TIMESTAMP}"
|
||||
HELPER_VERSION=$(sed -n "s/.*'helper_version' => '\([^']*\)'.*/\1/p" config/constants.php)
|
||||
REALTIME_VERSION=$(sed -n "s/.*'realtime_version' => '\([^']*\)'.*/\1/p" config/constants.php)
|
||||
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
|
|
@ -38,6 +40,7 @@ jobs:
|
|||
- name: Build image
|
||||
run: |
|
||||
DOCKER_BUILDKIT=1 docker build -f docker/production/Dockerfile \
|
||||
--build-arg MAPLEDEPLOY_VERSION=${{ steps.version.outputs.VERSION }} \
|
||||
-t ${{ env.REGISTRY }}/${{ github.repository }}:${{ steps.version.outputs.VERSION }} \
|
||||
-t ${{ env.REGISTRY }}/${{ github.repository }}:latest \
|
||||
.
|
||||
|
|
|
|||
|
|
@ -116,6 +116,16 @@ COPY --chown=www-data:www-data composer.json composer.lock ./
|
|||
COPY --chown=www-data:www-data app ./app
|
||||
COPY --chown=www-data:www-data bootstrap ./bootstrap
|
||||
COPY --chown=www-data:www-data config ./config
|
||||
|
||||
# MapleDeploy: inject build version into constants.php at build time.
|
||||
# The version in git stays at the upstream value to avoid rebase conflicts.
|
||||
# CI passes the timestamped version (e.g. 4.0.0-beta.468.202603140006) as a build arg.
|
||||
ARG MAPLEDEPLOY_VERSION=""
|
||||
RUN if [ -n "$MAPLEDEPLOY_VERSION" ]; then \
|
||||
sed -i "s/'version' => '[^']*'/'version' => '$MAPLEDEPLOY_VERSION'/" config/constants.php && \
|
||||
chown www-data:www-data config/constants.php; \
|
||||
fi
|
||||
|
||||
COPY --chown=www-data:www-data database ./database
|
||||
COPY --chown=www-data:www-data lang ./lang
|
||||
COPY --chown=www-data:www-data public ./public
|
||||
|
|
|
|||
Loading…
Reference in a new issue