Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f3067c4e authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Merge branch 'notest-release-tag' into 'master'

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

See merge request solverstack/chameleon!399
parents 18143a45 fc7840de
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
release: release:
stage: deploy stage: deploy
rules: 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: [] dependencies: []
artifacts: artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# @copyright 2013-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, # @copyright 2013-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved. # 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 # @version 1.2.0
# @author Florent Pruvost # @author Florent Pruvost
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
# Steps to do the release: # Steps to do the release:
# - Update information in the code (see update_release.sh) # - Update information in the code (see update_release.sh)
# - Update the ChangeLog # - Update the ChangeLog
# - Push the hash on solverstack as: # - Create a tag named vx.x.x and push it on solverstack (will trigger the CI to generate the release)
# - a tag named vx.x.x
# - a branch named release-x.x.x (will trigger the CI to generate the release)
# #
changelog="" changelog=""
function gen_changelog() function gen_changelog()
...@@ -40,7 +38,7 @@ function gen_changelog() ...@@ -40,7 +38,7 @@ function gen_changelog()
#echo $line #echo $line
done 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="" release=""
...@@ -50,9 +48,11 @@ function get_release() ...@@ -50,9 +48,11 @@ function get_release()
release=$( head -n $firstline ChangeLog | tail -n 1 | sed 's/chameleon\-//' ) 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. # Get the release name through the branch name, and through the ChangeLog file.
# Both have to match to be correct # 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 get_release
if [ -z "$RELEASE_NAME" -o -z "$release" -o "$RELEASE_NAME" != "$release" ] if [ -z "$RELEASE_NAME" -o -z "$release" -o "$RELEASE_NAME" != "$release" ]
...@@ -65,23 +65,22 @@ fi ...@@ -65,23 +65,22 @@ fi
wget https://raw.githubusercontent.com/Kentzo/git-archive-all/master/git_archive_all.py 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 python3 git_archive_all.py --force-submodules chameleon-$RELEASE_NAME.tar.gz
# upload the source archive # upload the source archive to the Gitlab's Package registry
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` 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"
MYURL=`eval $GETURL | jq .url | sed "s#\"##g"`
# extract the change log from ChangeLog # extract the change log from ChangeLog
gen_changelog gen_changelog
echo $changelog echo $changelog
# Try to remove the release if it already exists # 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 # create the release associated to the tag
COMMAND=`echo curl --header \"Content-Type: application/json\" --header \"PRIVATE-TOKEN: $RELEASE_TOKEN\" \ COMMAND=`echo curl --header \"Content-Type: application/json\" --header \"JOB-TOKEN: $CI_JOB_TOKEN\" \
--data \'{ \"name\": \"v$RELEASE_NAME\", \ --data \'{ \"name\": \"v$RELEASE_NAME\", \
\"tag_name\": \"v$RELEASE_NAME\", \ \"tag_name\": \"v$RELEASE_NAME\", \
\"ref\": \"$CI_COMMIT_REF_NAME\", \ \"ref\": \"$CI_COMMIT_REF_NAME\", \
\"description\": \"$changelog\", \ \"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` --request POST https://gitlab.inria.fr/api/v4/projects/$CI_PROJECT_ID/releases`
eval $COMMAND 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