init monorepo
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 22s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 1m38s
acc-tests Link to Cucumber reports
CI Feature / Cucumber tests (push) Successful in 1m2s
CI Feature / Report Summary (push) Successful in 5s
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 22s
unit-tests Link to Bats reports
CI Feature / Bats tests (push) Successful in 1m38s
acc-tests Link to Cucumber reports
CI Feature / Cucumber tests (push) Successful in 1m2s
CI Feature / Report Summary (push) Successful in 5s
This commit is contained in:
@@ -16,6 +16,8 @@ on:
|
||||
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GIT_TAG_PREFIX: ${{ fromJson(inputs.env_json).GIT_TAG_PREFIX || '' }}
|
||||
VERSION_FILE: ${{ fromJson(inputs.env_json).VERSION_FILE || '' }}
|
||||
|
||||
jobs:
|
||||
check:
|
||||
@@ -28,7 +30,13 @@ jobs:
|
||||
|
||||
- name: Check existing artifact and calculate version
|
||||
run: |
|
||||
if [ -f VERSION ]; then
|
||||
if [ -n "${VERSION_FILE}" ]; then
|
||||
if echo "${VERSION_FILE}" | grep -q '\.json$'; then
|
||||
RAW_VERSION=$(jq -r '.version' "${VERSION_FILE}")
|
||||
else
|
||||
RAW_VERSION=$(cat "${VERSION_FILE}" | tr -d '[:space:]')
|
||||
fi
|
||||
elif [ -f VERSION ]; then
|
||||
RAW_VERSION=$(cat VERSION | tr -d '[:space:]')
|
||||
elif [ -f package.json ]; then
|
||||
RAW_VERSION=$(jq -r '.version' package.json)
|
||||
@@ -44,7 +52,10 @@ jobs:
|
||||
TAGS_JSON=$(curl -s -f -H "Authorization: token $GITEA_TOKEN" \
|
||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/tags")
|
||||
|
||||
TAG=$(echo "$TAGS_JSON" | jq -r 'if type == "array" then .[] | select(.commit.sha == "${{ github.sha }}") | .name else empty end' | head -1)
|
||||
TAG=$(echo "$TAGS_JSON" | jq -r --arg prefix "${GIT_TAG_PREFIX}" '
|
||||
if type == "array" then
|
||||
.[] | select(.commit.sha == "${{ github.sha }}" and (.name | startswith($prefix))) | .name
|
||||
else empty end' | head -1)
|
||||
|
||||
mkdir -p /tmp/build-ctx
|
||||
|
||||
@@ -55,7 +66,7 @@ jobs:
|
||||
else
|
||||
echo "ARTIFACT_EXISTS=false" > /tmp/build-ctx/build.env
|
||||
|
||||
HIGHEST_PATCH=$(echo "$TAGS_JSON" | jq -r --arg bv "$BASE_VERSION." '
|
||||
HIGHEST_PATCH=$(echo "$TAGS_JSON" | jq -r --arg prefix "${GIT_TAG_PREFIX}" --arg bv "${GIT_TAG_PREFIX}${BASE_VERSION}." '
|
||||
if type == "array" then .[] | .name | select(startswith($bv)) | sub($bv; "") | tonumber else empty end' | sort -rn | head -1)
|
||||
|
||||
if [ -z "$HIGHEST_PATCH" ]; then NEXT_PATCH=0; else NEXT_PATCH=$((HIGHEST_PATCH + 1)); fi
|
||||
|
||||
Reference in New Issue
Block a user