diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cef2ceeed202b2a450efc8f956416fd396e32dd0..94724f8869fd13b1e3c9fe21c8426801684285ca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,18 +1,10 @@ variables: BUILDINFO_FILE: 'buildinfo.json' - -# Rules to not run a regular pipeline for merge requests to avoid duplicate pipelines -workflow: - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS - when: never - - if: $CI_COMMIT_BRANCH - stages: - prepare - build + - pre-release - release AppImage build environment image: @@ -27,26 +19,10 @@ AppImage build environment image: - docker push "$CI_REGISTRY_IMAGE/builder:latest" rules: - if: '$CI_PIPELINE_SOURCE == "web"' - when: manual - - -Retrieve build environment variables: - stage: prepare - image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest - script: - - 'echo "VERSION=$(jq -r .version ${BUILDINFO_FILE})" >> .env' - - 'echo "MIN_SERVER_VERSION=$(jq -r .minServerVersion ${BUILDINFO_FILE})" >> .env' - artifacts: - reports: - dotenv: .env - rules: - - if: '$CI_COMMIT_BRANCH == "master"' -# Retrieves environment variables by itself Build poppi AppImage: stage: build image: $CI_REGISTRY_IMAGE/builder:latest - needs: [] script: - make -j$(nproc) appimage - echo "BUILD_JOB_URL=$CI_JOB_URL" > .env @@ -56,16 +32,32 @@ Build poppi AppImage: expose_as: 'poppi_AppImage' reports: dotenv: .env + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_COMMIT_BRANCH == "master"' + - if: '$CI_PIPELINE_SOURCE == "web"' + +Retrieve build environment variables: + stage: pre-release + image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest + script: + - 'echo "VERSION=$(jq -r .version ${BUILDINFO_FILE})" >> .env' + - 'echo "MIN_SERVER_VERSION=$(jq -r .minServerVersion ${BUILDINFO_FILE})" >> .env' + artifacts: + reports: + dotenv: .env + rules: + - if: '$CI_COMMIT_BRANCH == "master"' Check if release exists: - stage: release + stage: pre-release image: registry.gitlab.com/gitlab-ci-utils/curl-jq:latest needs: - Retrieve build environment variables script: - 'echo "Checking if release exists..."' - 'RELEASE_TAG="v${VERSION}"' - - 'EXISTING_RELEASE_NAME=$(curl -s -S --header "JOB-TOKEN: $CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/releases" | jq ".[] | select(.tag_name == \"${RELEASE_TAG}\") | .name")' + - 'EXISTING_RELEASE_NAME=$(curl -s -S --header "JOB-TOKEN: $CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/releases" | jq -r ".[] | select(.tag_name == \"${RELEASE_TAG}\") | .name")' - 'if [ -z "${EXISTING_RELEASE_NAME}" ]; then echo "Release ${RELEASE_TAG} does not exist"; else echo "Release ${RELEASE_TAG} exists with name \"${EXISTING_RELEASE_NAME}\""; fi' - 'echo "EXISTING_RELEASE_NAME=${EXISTING_RELEASE_NAME}" > .env' artifacts: @@ -74,7 +66,7 @@ Check if release exists: rules: - if: '$CI_COMMIT_BRANCH == "master"' -Create package: +Create package if new version: stage: release needs: - Retrieve build environment variables @@ -92,13 +84,13 @@ Create package: rules: - if: '$CI_COMMIT_BRANCH == "master"' -Create release: +Create release if new version: stage: release needs: - Retrieve build environment variables - Build poppi AppImage - Check if release exists - - Create package + - Create package if new version image: registry.gitlab.com/gitlab-org/release-cli:latest script: - | diff --git a/buildinfo.json b/buildinfo.json index 3b9b6aef7d797116c41156b50ded18ddd3cdb1a6..a03d553d0c44ec96a2906f24b9629d729ec3a155 100644 --- a/buildinfo.json +++ b/buildinfo.json @@ -1,4 +1,4 @@ { - "version": "0.1.14", + "version": "0.1.15", "minServerVersion": "0.1.0" }