Update .gitlab-ci.yml file
This commit is contained in:
parent
a3159e23c8
commit
40cb532dc0
1 changed files with 27 additions and 62 deletions
|
@ -1,68 +1,33 @@
|
||||||
stages:
|
stages:
|
||||||
- sync
|
- update_patched_master
|
||||||
- patch
|
|
||||||
- build
|
|
||||||
- release
|
|
||||||
|
|
||||||
# Sync the upstream repository
|
variables:
|
||||||
sync:
|
GIT_STRATEGY: fetch
|
||||||
stage: sync
|
GIT_SSL_NO_VERIFY: "1"
|
||||||
script:
|
|
||||||
- echo "Syncing upstream master branch..."
|
|
||||||
- git fetch origin master
|
|
||||||
- git reset --hard origin/master
|
|
||||||
rules:
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "schedule"' # Trigger on schedule or manual action
|
|
||||||
|
|
||||||
# Apply patches
|
update_patched_master:
|
||||||
patch:
|
stage: update_patched_master
|
||||||
stage: patch
|
only:
|
||||||
|
- patched_changes
|
||||||
script:
|
script:
|
||||||
- echo "Switching to patched_master branch..."
|
- echo "Setting up Git..."
|
||||||
- git fetch origin patched_master || true
|
- git config user.name "$GITLAB_USER_NAME"
|
||||||
- git checkout -b patched_master || git checkout patched_master
|
- git config user.email "$GITLAB_USER_EMAIL"
|
||||||
- echo "Merging upstream changes into patched_master..."
|
- git remote set-url origin https://oauth2:${GITLAB_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
|
||||||
- git merge origin/master --no-ff -m "Merge upstream changes into patched_master"
|
- echo "Fetching all branches..."
|
||||||
- echo "Applying custom patches..."
|
- git fetch --all
|
||||||
- git fetch origin patched_changes
|
- echo "Checking out patched_master..."
|
||||||
- git checkout patched_changes
|
|
||||||
- git merge patched_master --no-ff -m "Applying custom patches"
|
|
||||||
- echo "Updating patched_master with patched_changes..."
|
|
||||||
- git checkout patched_master
|
- git checkout patched_master
|
||||||
- git merge patched_changes --no-ff -m "Merged patches into patched_master"
|
- echo "Merging master into patched_master..."
|
||||||
|
- git merge origin/master --no-edit
|
||||||
|
- echo "Cleaning working directory..."
|
||||||
|
- git rm -r --cached .
|
||||||
|
- git clean -fd
|
||||||
|
- echo "Overwriting all files from patched_changes (excluding .gitlab-ci.yml)..."
|
||||||
|
- git checkout origin/patched_changes -- . ':!.gitlab-ci.yml'
|
||||||
|
- echo "Adding changes..."
|
||||||
|
- git add .
|
||||||
|
- echo "Committing changes..."
|
||||||
|
- git commit -m "Auto-update patched_master with changes from patched_changes"
|
||||||
|
- echo "Pushing changes to patched_master..."
|
||||||
- git push origin patched_master
|
- git push origin patched_master
|
||||||
rules:
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "patched_changes"' # Trigger when patched_changes updates
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"' # Trigger when master updates
|
|
||||||
|
|
||||||
# Build process
|
|
||||||
build:
|
|
||||||
stage: build
|
|
||||||
image: registry:java-core-builder:latest # Use Gradle with Java 21
|
|
||||||
script:
|
|
||||||
- echo "Building with Gradle on Java 21..."
|
|
||||||
- java -version
|
|
||||||
- ./gradlew clean :daemon:shadowJar
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- daemon/build/libs/ # Artifacts path
|
|
||||||
expire_in: 7 days # Artifacts expiration time
|
|
||||||
rules:
|
|
||||||
- if: '$CI_COMMIT_TAG' # Trigger on new tag
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "patched_master"' # Trigger when patched_master updates
|
|
||||||
|
|
||||||
# Prepare release artifacts
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
image: alpine:latest # Minimal Docker image for release
|
|
||||||
script:
|
|
||||||
- echo "Preparing release artifacts..."
|
|
||||||
- mkdir -p release
|
|
||||||
- cp daemon/build/libs/*.jar release/
|
|
||||||
- echo "Release artifact generated."
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- release/ # Path for release artifacts
|
|
||||||
expire_in: 7 days
|
|
||||||
rules:
|
|
||||||
- if: '$CI_COMMIT_TAG' # Trigger only on new tags
|
|
||||||
|
|
Loading…
Reference in a new issue