Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoBackendAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Dojo Project (HES-SO)
Projects
Backend
DojoBackendAPI
Commits
67d5298b
Commit
67d5298b
authored
1 year ago
by
michael.minelli
Browse files
Options
Downloads
Plain Diff
Merge branch 'release_by_ci-cd' into v2.0.0
parents
1946add0
31c8d91d
No related branches found
No related tags found
No related merge requests found
Pipeline
#26337
passed
1 year ago
Stage: test
Stage: clean
Stage: release
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+79
-3
79 additions, 3 deletions
.gitlab-ci.yml
CHANGELOG.md
+35
-0
35 additions, 0 deletions
CHANGELOG.md
with
114 additions
and
3 deletions
.gitlab-ci.yml
+
79
−
3
View file @
67d5298b
...
@@ -3,15 +3,91 @@ variables:
...
@@ -3,15 +3,91 @@ variables:
GIT_SUBMODULE_FORCE_HTTPS
:
"
true"
GIT_SUBMODULE_FORCE_HTTPS
:
"
true"
SECURE_FILES_DOWNLOAD_PATH
:
'
./'
SECURE_FILES_DOWNLOAD_PATH
:
'
./'
VERSION_DEV_SUFFIX
:
'
-dev'
GITLAB_API_PROJECT_URL
:
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}
PROJECT_FOLDER
:
ExpressAPI
.get_version
:
script
:
-
IS_DEV=$([[ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]] && echo
false
|| echo
true
)
-
VERSION=$(jq -r .version $PROJECT_FOLDER/package.json)$([[ $IS_DEV ==
true
]] && echo $VERSION_DEV_SUFFIX || echo '')
.clean_release
:
script
:
# Delete release if it already exists
-
'
curl
--request
DELETE
--header
"JOB-TOKEN:
$CI_JOB_TOKEN"
"${GITLAB_API_PROJECT_URL}/releases/${VERSION}"'
# Delete tag if it already exists (use private-token because job-token don't have permission to delete tags)
-
'
curl
--request
DELETE
--header
"PRIVATE-TOKEN:
$GITLAB_PROJECT_ACCESS_TOKEN"
"${GITLAB_API_PROJECT_URL}/repository/tags/${VERSION}"'
stages
:
stages
:
-
test
-
test
-
clean
-
release
build:test
:
image
:
node:latest
test:build
:
stage
:
test
stage
:
test
image
:
node:latest
tags
:
tags
:
-
build
-
build
script
:
script
:
-
cd ExpressAPI
-
cd ExpressAPI
-
npm install
-
npm install
-
npm run build
-
npm run build
\ No newline at end of file
rules
:
-
if
:
'
$CI_COMMIT_TAG
=~
"/^$/"'
clean:release
:
stage
:
clean
tags
:
-
gitlab_clean
image
:
registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script
:
-
!reference
[
.get_version
,
script
]
-
!reference
[
.clean_release
,
script
]
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
$CI_DEFAULT_BRANCH
||
$CI_COMMIT_BRANCH
=~
/^v[0-9]+(\.[0-9]+)*$/'
clean:dev:release
:
stage
:
clean
tags
:
-
gitlab_clean
image
:
registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script
:
-
!reference
[
.get_version
,
script
]
-
VERSION="${VERSION}${VERSION_DEV_SUFFIX}"
-
!reference
[
.clean_release
,
script
]
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
$CI_DEFAULT_BRANCH'
release:gitlab
:
stage
:
release
tags
:
-
release
image
:
registry.gitlab.com/gitlab-ci-utils/curl-jq:latest
script
:
-
!reference
[
.get_version
,
script
]
-
echo 'Running release_job'
# Extract description from CHANGELOG.md
-
CHANGELOG_LINE_START=`awk '/##\ [0-9]+\.[0-9]+\.[0-9]+/{print NR; exit;}' CHANGELOG.md`
-
CHANGELOG_LINE_END=`awk '/##\ [0-9]+\.[0-9]+\.[0-9]+/{ count++; if(count>1) {print NR; exit;}}' CHANGELOG.md`
-
DESCRIPTION=`awk 'NR > '$CHANGELOG_LINE_START' && NR < '$CHANGELOG_LINE_END'' CHANGELOG.md`
# Create Release (can't be done by release_step of gitlab image because it don't have access to env var defined in script_step)
-
>
RELEASE_DATA=$(jq --null-input --arg version "$VERSION" --arg description "# Changelog (version $VERSION) $DESCRIPTION" --arg tag_name "$VERSION" --arg ref "$CI_COMMIT_SHORT_SHA" '{
"name": $version,
"description": $description,
"tag_name": $tag_name,
"ref": $ref
}')
-
>
curl --data "${RELEASE_DATA}" \
--header "Content-Type: application/json" \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--request POST "${GITLAB_API_PROJECT_URL}/releases"
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
$CI_DEFAULT_BRANCH
||
$CI_COMMIT_BRANCH
=~
/^v[0-9]+(\.[0-9]+)*$/'
This diff is collapsed.
Click to expand it.
CHANGELOG.md
0 → 100644
+
35
−
0
View file @
67d5298b
# Changelog
<!--
### ✨ Feature
### 🤏 Minor change
### 🎨 Interface
### 🐛 Bugfix
### 🔒 Security
### 🚀️ CI / CD
### 🔨 Internal / Developers
### 📚 Documentation
**💥 Breaking:**
**⚠️ Deprecation:**
-->
## 2.0.0 (2023-09-15)
### ✨ Feature
-
Added license: AGPLv3
### 🎨 Interface
-
**💥 Breaking:**
Renamed
`enonce`
to
`assignment`
-
**💥 Breaking:**
Renamed
`exercice`
to
`exercise`
### 🔨 Internal / Developers
-
Auto release by pipeline
-
For vX.Y.Z branch create release and tag with
`-dev`
suffix
-
For main branch create definitive release and remove
`-dev`
releases
## 1.0.1 (2023-08-12)
### ✨ Feature
-
🎉 Initial release of the project
\ No newline at end of file
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