BlueGit

timfa containerpipes

Files

containerpipes / scripts / ci / build.sh

build.sh

build.sh 1.1 KiB Download Raw
1#!/usr/bin/env bash
2# Versie bepalen (tag, RELEASE_VERSION, of hoogste tag + 1 patch), zelfde bump als
3# scripts/release.sh (alleen lokaal in de build, geen commit), jar bouwen.
4set -euo pipefail
5if [ -n "${RELEASE_VERSION:-}" ]; then v="${RELEASE_VERSION#v}"
6elif [ -n "${CI_COMMIT_TAG:-}" ]; then v="${CI_COMMIT_TAG#v}"
7else
8 last="$(git tag -l | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' | sed 's/^v//' | sort -V | tail -n1 || true)"
9 IFS=. read -r a b c <<<"${last:-0.0.0}"; v="$a.$b.$((c+1))"
10fi
11echo "Versie voor deze build: $v"
12sed -i "s/^version = \".*\"/version = \"${v}\"/" build.gradle.kts
13sed -i "s/^version: '.*/version: '${v}'/" src/main/resources/plugin.yml
14sed -i -E "s/ContainerPipes [0-9]+\.[0-9]+\.[0-9]+ enabled/ContainerPipes ${v} enabled/" src/main/java/nl/timfalken/containerpipes/ContainerPipesPlugin.java
15[ "${DRY:-}" = 1 ] && { grep -n "^version" build.gradle.kts src/main/resources/plugin.yml; exit 0; }
16gradle --no-daemon clean shadowJar
17mkdir -p build/out
18cp "build/libs/ContainerPipes-${v}.jar" build/out/ContainerPipes.jar
19echo "$v" > build/version.txt
20ls -la build/out