Skip to content

Commit

Permalink
Move scripts to root, remove linking script, link from libs into onyx…
Browse files Browse the repository at this point in the history
…ia instead, add a script to update onyxia-api
  • Loading branch information
garronej committed Sep 24, 2023
1 parent 0f5fafe commit cb48144
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 215 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"_format": "prettier '**/*.{ts,tsx,json,md}'",
"format": "yarn _format --write",
"format:check": "yarn _format --list-different",
"link_inhouse_deps": "ts-node --skip-project src/bin/link_inhouse_deps.ts",
"emails_domain_accept_list_helper": "ts-node --skip-project src/bin/emails_domain_accept_list_helper.ts"
"emails-domain-accept-list-helper": "ts-node --skip-project src/bin/emails-domain-accept-list-helper.ts"
},
"dependencies": {
"onyxia-ui": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import {
emailDomainsToRegExpStr,
regExpStrToEmailDomains
} from "keycloak-theme/login/emailDomainAcceptListHelper";
} from "../src/keycloak-theme/login/emailDomainAcceptListHelper";

const emailDomains = regExpStrToEmailDomains(
"^[^@]+@([^.]+\\.)*((insee\\.fr)|(gouv\\.fr)|(polytechnique\\.edu)|(ensae\\.fr)|(ensai\\.fr)|(centralesupelec\\.fr)|(student-cs\\.fr)|(student\\.ecp\\.fr)|(supelec\\.fr)|(ign\\.fr)|(has-sante\\.fr)|(casd\\.eu)|(ars\\.sante\\.fr)|(ansm\\.sante\\.fr)|(cnaf\\.fr)|(ac-lille\\.fr)|(ac-amiens\\.fr)|(ac-normandie\\.fr)|(ac-reims\\.fr)|(ac-nancy-metz\\.fr)|(ac-strasbourg\\.fr)|(ac-creteil\\.fr)|(ac-paris\\.fr)|(nantesmetropole\\.fr)|(ac-versailles\\.fr)|(ac-rennes\\.fr)|(ac-nantes\\.fr)|(ac-orleans-tours\\.fr)|(ac-dijon\\.fr)|(ac-besancon\\.fr)|(ac-poitiers\\.fr)|(ac-limoges\\.fr)|(ac-clermont\\.fr)|(ac-lyon\\.fr)|(ac-grenoble\\.fr)|(ac-bordeaux\\.fr)|(ac-toulouse\\.fr)|(ac-montpellier\\.fr)|(ac-aix-marseille\\.fr)|(ac-nice\\.fr)|(ac-corse\\.fr)|(ac-martinique\\.fr)|(ac-guadeloupe\\.fr)|(ac-reunion\\.fr)|(ac-guyane\\.fr)|(ac-mayotte\\.fr)|(ac-wf\\.wf)|(monvr\\.pf)|(anfr\\.fr)|(ccomptes\\.fr)|(ac-noumea\\.nc)|(ac-spm\\.fr)|(inrae\\.fr)|(inria\\.fr)|(irsn\\.fr)|(assemblee-nationale\\.fr)|(hceres\\.fr)|(ext\\.ec\\.europa\\.eu)|(health-data-hub\\.fr)|(datactivist\\.coop)|(inpi\\.fr)|(telecom-paris\\.fr)|(ineris\\.fr)|(cerema\\.fr)|(cnrs\\.fr)|(univ-paris1\\.fr)|(ens-paris-saclay\\.fr)|(ens\\.fr)|(ens-lyon\\.fr)|(cereq\\.fr)|(univ-eiffel\\.fr)|(chu-toulouse\\.fr))$"
Expand Down
58 changes: 58 additions & 0 deletions scripts/update-api.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

# Find the repository root by looking for the .git directory
while [[ ! -d ".git" && "$PWD" != "/" ]]; do
cd ..
done

if [[ ! -d ".git" ]]; then
echo "Error: Run this script from the root of the project"
exit 1
fi

git submodule update --init --recursive &>/dev/null

# Assuming api/ is a submodule at the repository root
API_SUBMODULE="api"

# Navigate to the submodule directory
cd $API_SUBMODULE

# Fetch all tags from remote
git fetch --tags &>/dev/null

# Get the latest tag name
latestTag=$(git describe --tags $(git rev-list --tags --max-count=1))

currentTag=$(git describe --tags $(git rev-parse HEAD))

# Check if the latest tag points to the current commit
if [ "$latestTag" == "$currentTag" ]; then
echo "Onyxia API is alredy pinned to the latest version: $latestTag"
exit 0
fi

# Checkout the latest tag
git checkout $latestTag &>/dev/null

# Navigate back to the main repository directory
cd ..

# Add the submodule change
git add $API_SUBMODULE

# Ask for user confirmation
read -p "Do you want to pin onyxia-api to $latestTag (Currently pinned is $currentTag)? " \
"This will trigger a new release of the Onyxia Helm Chart once pushed. " \
"Press 'y' then Enter to confirm: " -n 1 -r
echo # Move to a new line

if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Abort. Changes not committed."
exit 1
fi

# Commit the update
git commit -m "Bump onyxia-api pin to $latestTag (previously pinned to $currentTag)"

echo "Done. Don't forget to push the changes to the remote repository. 👋"
212 changes: 0 additions & 212 deletions src/bin/link_inhouse_deps.ts

This file was deleted.

0 comments on commit cb48144

Please sign in to comment.