Mentions légales du service

Skip to content
Snippets Groups Projects
Commit fc7840de authored by PRUVOST Florent's avatar PRUVOST Florent Committed by Mathieu Faverge
Browse files

Change the way we generate the release: push a new tag instead of pushing on a...

parent 18143a45
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
release:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH =~ /^release-.*$/ && $CI_PIPELINE_SOURCE != "schedule"
- if: $CI_COMMIT_TAG =~ /^v[0-9]\.[0-9]\.[0-9]$/ && $CI_PIPELINE_SOURCE != "schedule"
dependencies: []
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
......
......@@ -5,7 +5,7 @@
# @copyright 2013-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
# @brief Script to generate the release when pushing a branch and tag of the same name
# @brief Script to generate the release when pushing a tag
#
# @version 1.2.0
# @author Florent Pruvost
......@@ -18,9 +18,7 @@
# Steps to do the release:
# - Update information in the code (see update_release.sh)
# - Update the ChangeLog
# - Push the hash on solverstack as:
# - a tag named vx.x.x
# - a branch named release-x.x.x (will trigger the CI to generate the release)
# - Create a tag named vx.x.x and push it on solverstack (will trigger the CI to generate the release)
#
changelog=""
function gen_changelog()
......@@ -40,7 +38,7 @@ function gen_changelog()
#echo $line
done
changelog="$changelog\nWARNING: Download the source archive by clicking on the link __Download release__ above, please do not consider the automatic Source code links as they are missing the submodules.\n"
changelog="$changelog\nWARNING: Download the source archive by clicking on the link __Download release__ above, please do not consider the automatic Source code links as they are missing the submodules.\nVisit the [documentation](https://solverstack.gitlabpages.inria.fr/chameleon/#quickstart-install) to see how to install Chameleon."
}
release=""
......@@ -50,9 +48,11 @@ function get_release()
release=$( head -n $firstline ChangeLog | tail -n 1 | sed 's/chameleon\-//' )
}
set -x
# Get the release name through the branch name, and through the ChangeLog file.
# Both have to match to be correct
RELEASE_NAME=`echo $CI_COMMIT_REF_NAME | cut -d - -f 2`
RELEASE_NAME=`echo $CI_COMMIT_TAG | cut -d v -f 2`
get_release
if [ -z "$RELEASE_NAME" -o -z "$release" -o "$RELEASE_NAME" != "$release" ]
......@@ -65,23 +65,22 @@ fi
wget https://raw.githubusercontent.com/Kentzo/git-archive-all/master/git_archive_all.py
python3 git_archive_all.py --force-submodules chameleon-$RELEASE_NAME.tar.gz
# upload the source archive
GETURL=`echo curl --request POST --header \"PRIVATE-TOKEN: $RELEASE_TOKEN\" --form \"file=\@chameleon-$RELEASE_NAME.tar.gz\" https://gitlab.inria.fr/api/v4/projects/$CI_PROJECT_ID/uploads`
MYURL=`eval $GETURL | jq .url | sed "s#\"##g"`
# upload the source archive to the Gitlab's Package registry
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./chameleon-$RELEASE_NAME.tar.gz "https://gitlab.inria.fr/api/v4/projects/$CI_PROJECT_ID/packages/generic/source/$CI_COMMIT_TAG/chameleon-$RELEASE_NAME.tar.gz"
# extract the change log from ChangeLog
gen_changelog
echo $changelog
# Try to remove the release if it already exists
curl --request DELETE --header "PRIVATE-TOKEN: $RELEASE_TOKEN" https://gitlab.inria.fr/api/v4/projects/$CI_PROJECT_ID/releases/v$RELEASE_NAME
curl --request DELETE --header "JOB-TOKEN: $CI_JOB_TOKEN" https://gitlab.inria.fr/api/v4/projects/$CI_PROJECT_ID/releases/v$RELEASE_NAME
# create the release and the associated tag
COMMAND=`echo curl --header \"Content-Type: application/json\" --header \"PRIVATE-TOKEN: $RELEASE_TOKEN\" \
# create the release associated to the tag
COMMAND=`echo curl --header \"Content-Type: application/json\" --header \"JOB-TOKEN: $CI_JOB_TOKEN\" \
--data \'{ \"name\": \"v$RELEASE_NAME\", \
\"tag_name\": \"v$RELEASE_NAME\", \
\"ref\": \"$CI_COMMIT_REF_NAME\", \
\"description\": \"$changelog\", \
\"assets\": { \"links\": [{ \"name\": \"Download release\", \"url\": \"$CI_PROJECT_URL$MYURL\" }] } }\' \
\"assets\": { \"links\": [{ \"name\": \"Download release chameleon-$RELEASE_NAME.tar.gz\", \"url\": \"https://gitlab.inria.fr/api/v4/projects/$CI_PROJECT_ID/packages/generic/source/$CI_COMMIT_TAG/chameleon-$RELEASE_NAME.tar.gz\" }] } }\' \
--request POST https://gitlab.inria.fr/api/v4/projects/$CI_PROJECT_ID/releases`
eval $COMMAND
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment