Skip to content
Snippets Groups Projects
Commit dd3fe929 authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[release] use API to generate the release

parent 5d648209
No related branches found
No related tags found
No related merge requests found
......@@ -265,6 +265,7 @@ release-content:
- website
- wiki
- opam-repository
- release-data.json
only:
variables:
- $RELEASE == "yes"
......@@ -400,7 +401,7 @@ src-distrib-tests-long:
- echo "$FRAMA_CI_BOT_SSH_PRIVATE" | nix run -f channel:nixos-19.03 coreutils --command base64 -d > nix/frama-c-public/id_ed25519
- nix run -f channel:nixos-19.03 coreutils --command chmod 400 nix/frama-c-public/id_ed25519
release-frama-c:
release-branch:
stage: release
<<: *prepare_ssh_template
script:
......@@ -412,6 +413,20 @@ release-frama-c:
when: manual
interruptible: false
release-create:
stage: release
script:
- (! git merge-base --is-ancestor a1e186c68a6418a53b3dc06237f49e8dcbf75f4a origin/$CI_COMMIT_BRANCH)
- nix-shell -p curl --run './nix/frama-c-public/publish-release.sh'
needs:
- release-branch
- release-content
only:
variables:
- $RELEASE == "yes"
when: manual
interruptible: false
release-opam:
stage: release
<<: *prepare_ssh_template
......
......@@ -38,6 +38,7 @@
# - wiki (for the public Frama-C instance)
# - website
# - opam-repository
# - release-data.json
# with the correct tree for generated files.
##########################################################################
......@@ -89,6 +90,13 @@ CODENAME="$(cat VERSION_CODENAME)"
LOWER_CODENAME="$(echo "$CODENAME" | tr '[:upper:]' '[:lower:]')"
VERSION_AND_CODENAME="${VERSION_SAFE}-${CODENAME}"
if [ "$VERSION_MINOR" != 0 ]; then
PREVIOUS="$VERSION_MAJOR.$(($VERSION_MINOR - 1))"
else
PREVIOUS="$(($VERSION_MAJOR - 1)).0"
fi
PREVIOUS_NAME=$(git show $PREVIOUS:VERSION_CODENAME)
if [ "$VERSION_MODIFIER" == "+dev" ]; then
echo "Development version ($VERSION)"
echo_red "Aborting"
......@@ -259,7 +267,7 @@ echo "Opam file built"
##########################################################################
# Make wiki
show_step "Building website"
show_step "Building wiki"
WIKI_DIR="wiki"
......@@ -295,6 +303,38 @@ sed 's/\(\#.*\)/##\1/' $CHANGES >> $WIKI_PAGE
echo "Wiki page built"
##########################################################################
# Make wiki
show_step "Building release json file"
JSON_DATA="release-data.json"
cat >$JSON_DATA <<EOL
{
"name": "Frama-C $VERSION $CODENAME",
"tag_name": "$VERSION_SAFE",
"ref": "stable/$LOWER_CODENAME",
"assets": {
"links": [
{
"name": "API Documentation",
"url": "https://frama-c.com/download/frama-c-$VERSION_AND_CODENAME-api.tar.gz",
"link_type":"other"
},
{
"name": "Official source archive",
"url": "https://frama-c.com/download/$TARGZ_VERSION",
"link_type":"other"
}
]
},
EOL
echo " \"description\": \"# Main changes since $PREVIOUS $PREVIOUS_NAME\n$(cat $CHANGES | sed -z 's/\n/\\n/g' | sed 's/\(\#.*\)/#\1/')\"" >> $JSON_DATA
echo "}" >> $JSON_DATA
echo "Release data file built"
##########################################################################
# Make website
......@@ -344,13 +384,6 @@ echo "Installation file built"
mkdir -p $WEBSITE_EVENTS_DIR
if [ "$VERSION_MINOR" != 0 ]; then
PREVIOUS="$VERSION_MAJOR.$(($VERSION_MINOR - 1))"
else
PREVIOUS="$(($VERSION_MAJOR - 1)).0"
fi
PREVIOUS_NAME=$(git show $PREVIOUS:VERSION_CODENAME)
TEXTUAL_VERSION="Frama-C $VERSION ($CODENAME)"
TEXTUAL_PREVIOUS="Frama-C $PREVIOUS ($PREVIOUS_NAME)"
......
#! /usr/bin/env bash
##########################################################################
# #
# This file is part of Frama-C. #
# #
# Copyright (C) 2007-2022 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
# you can redistribute it and/or modify it under the terms of the GNU #
# Lesser General Public License as published by the Free Software #
# Foundation, version 2.1. #
# #
# It is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU Lesser General Public License for more details. #
# #
# See the GNU Lesser General Public License version 2.1 #
# for more details (enclosed in the file licenses/LGPLv2.1). #
# #
##########################################################################
# Note:
#
# While this script can be run locally, it is meant to run in the Frama-C CI.
# Thus, it expects to be run from the root of the Frama-C directory and that
# some CI artifacts are available. Namely:
# - 'release-data.json' as generated by the script Frama-C/dev/build-release.sh
# - the 'FRAMA_CI_BOT_RELEASE_TOKEN' variable
# - the stable branch must be available on 'pub/frama-c'
# Availability of the file is NOT checked when the script starts.
##########################################################################
curl \
--header 'Content-Type: application/json' \
--header "PRIVATE-TOKEN:$FRAMA_CI_BOT_RELEASE_TOKEN" \
--data-binary "@release-data.json" \
--request POST \
"https://git.frama-c.com/api/v4/projects/1113/releases"
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