Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Runner Test
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gin Derick Magno
Runner Test
Commits
24a56728
Commit
24a56728
authored
2 years ago
by
Gin Derick Magno
Browse files
Options
Downloads
Patches
Plain Diff
Update .gitlab-ci.yaml
parent
b90c1357
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yaml
+69
-7
69 additions, 7 deletions
.gitlab-ci.yaml
with
69 additions
and
7 deletions
.gitlab-ci.yaml
+
69
−
7
View file @
24a56728
image
:
node
stages
:
stages
:
-
check_build
-
build
-
build
-
set_tag
build
:
stage
:
build
script
:
-
npm install
only
:
-
/^koda-chm-.*-stg$/
-
/^koda-chm-.*-dev$/
variables
:
.setup
:
VERSION
:
"
1.0.0"
before_script
:
-
LATEST_BUILD="$(tail -n 1 build.log)"
-
ENVIRONMENT=$(echo "$CI_COMMIT_REF_NAME" | awk -F '-' '{print $NF}')
-
PROJECT_NAME="${LATEST_BUILD%%-*}"
-
PROJECT_NAME_WITH_ENV="${LATEST_BUILD%%-*}.$ENVIRONMENT"
-
FORMATTED_PROJECT_NAME="${PROJECT_NAME_WITH_ENV//./-}"
-
echo $FORMATTED_PROJECT_NAME
-
CURRENT_DATE=$(date +%Y.%m.%d)
-
VERSION=$(echo "$LATEST_BUILD" | awk -F '-' '{print $NF}')
-
NEW_VERSION="${VERSION%.*}.$((${VERSION##*.} + 1))"
-
NEW_BUILD="${PROJECT_NAME_WITH_ENV}-${CURRENT_DATE}-${NEW_VERSION}"
-
NEW_BUILD_LOG="${PROJECT_NAME}-${CURRENT_DATE}-${NEW_VERSION}"
build_job
:
check_build
:
stage
:
build
extends
:
.setup
stage
:
check_build
script
:
-
if [[ "$CI_COMMIT_REF_NAME" != "$FORMATTED_PROJECT_NAME" ]]; then exit 1; fi
only
:
-
/^koda-chm-.*-stg$/
-
/^koda-chm-.*-dev$/
.tag
:
extends
:
.setup
stage
:
set_tag
set-tag-dev
:
extends
:
.tag
script
:
-
|
echo "$NEW_BUILD_LOG" | tee -a build.log
git status
git fetch --tags
echo "$CI_COMMIT_REF_NAME"
git add build.log
# "[ci skip]" and "-o ci-skip" prevent a CI trigger loop
git commit -m "[ci skip] updated build $NEW_BUILD"
git push -o ci-skip https://oauth2:$ACCESS_TOKEN@gitlab.com/test-group1430/runner-testing.git HEAD:$CI_COMMIT_REF_NAME
#Tag commit (can be used without commiting files)
git tag "$NEW_BUILD"
git push --tags https://oauth2:$ACCESS_TOKEN@gitlab.com/test-group1430/runner-testing.git HEAD:$CI_COMMIT_REF_NAME
only
:
-
/^koda-chm-.*-dev$/
set-tag-stg
:
extends
:
.tag
script
:
script
:
-
echo "Building version $VERSION"
-
|
-
make build
git status
git fetch --tags
echo "$CI_COMMIT_REF_NAME"
#Tag commit (can be used without commiting files)
git tag "$NEW_BUILD"
git push --tags https://oauth2:$ACCESS_TOKEN@gitlab.com/test-group1430/runner-testing.git HEAD:$CI_COMMIT_REF_NAME
only
:
only
:
-
main
# Run the job only for the master branch (customize as needed)
-
/^koda-chm-.*-stg$/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment