Skip to content

Commit

Permalink
refactor: new build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-Guillemin committed Jan 10, 2024
1 parent 0507faf commit f331dbb
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 30 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Gestion locale des comptes.
## Prepare environment

```bash
./init.sh
./scripts/init.sh
```

Complete the `.env.local` (located at root) file and the `application-dev.yml` file (located in `src/main/resources/config`).
Expand All @@ -32,5 +32,5 @@ yarn dev
## Build

```bash
./build.sh
./scripts/build.sh
```
12 changes: 0 additions & 12 deletions build.sh

This file was deleted.

16 changes: 0 additions & 16 deletions init.sh

This file was deleted.

54 changes: 54 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

echo "GLC Bulding Tool"
echo ""
echo "0 -> package"
echo "1 -> shapshot"
echo "2 -> release"
echo ""

read -p "Choose build type: " choice

init () {
echo "--- Initialize ---"
source ./scripts/init.sh
}

package () {
echo "--- Package ---"
./mvnw clean package -P prod -Dmaven.test.skip=true -Darguments="-DskipTests -Dmaven.deploy.skip=true"
}

snapshot () {
echo "--- Snapshot ---"
./mvnw clean package deploy -P prod -Dmaven.test.skip=true -Darguments="-DskipTests -Dmaven.deploy.skip=true"
}

release () {
echo "--- Release ---"
./mvnw clean package release:prepare release:perform -P prod -Dmaven.test.skip=true -Darguments="-DskipTests -Dmaven.deploy.skip=true"
}

case $choice in

0)
init
if yarn build; then package; fi
;;

1)
init
if yarn build; then snapshot; fi
;;

2)
init
if yarn build; then release; fi
;;

*)
echo "Unknown choice"
;;

esac
echo "GLC Builder"
19 changes: 19 additions & 0 deletions scripts/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

source ~/.nvm/nvm.sh
source ~/.sdkman/bin/sdkman-init.sh

# Frontend
nvm install
npm i -g yarn
yarn
yarn prepare
yarn predev

# Backend
if ! sdk env; then
sdk env install
fi
if [ ! -f "src/main/resources/config/application-dev.yml" ]; then
cp -u src/main/resources/config/application-dev.example.yml src/main/resources/config/application-dev.yml
fi

0 comments on commit f331dbb

Please sign in to comment.