mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-05 13:02:54 +00:00
ci: polish publishing via ci pipelines
This commit is contained in:
@@ -14,7 +14,6 @@
|
|||||||
"@openstapps/minimal-deployment": "2.0.0",
|
"@openstapps/minimal-deployment": "2.0.0",
|
||||||
"@openstapps/minimal-plugin": "2.0.0",
|
"@openstapps/minimal-plugin": "2.0.0",
|
||||||
"@openstapps/app": "2.0.0",
|
"@openstapps/app": "2.0.0",
|
||||||
"@openstapps/app-release-template": "2.0.0",
|
|
||||||
"@openstapps/api": "2.0.0",
|
"@openstapps/api": "2.0.0",
|
||||||
"@openstapps/api-cli": "2.0.0",
|
"@openstapps/api-cli": "2.0.0",
|
||||||
"@openstapps/api-plugin": "2.0.0",
|
"@openstapps/api-plugin": "2.0.0",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
'@openstapps/projectmanagement': patch
|
'@openstapps/projectmanagement': patch
|
||||||
'@openstapps/prettier-config': patch
|
'@openstapps/prettier-config': patch
|
||||||
'@openstapps/app-release-template': patch
|
|
||||||
'@openstapps/es-mapping-generator': patch
|
'@openstapps/es-mapping-generator': patch
|
||||||
'@openstapps/backend-config': patch
|
'@openstapps/backend-config': patch
|
||||||
'@openstapps/eslint-config': patch
|
'@openstapps/eslint-config': patch
|
||||||
|
|||||||
@@ -7,14 +7,18 @@
|
|||||||
# ```
|
# ```
|
||||||
# To your pipeline.
|
# To your pipeline.
|
||||||
# https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html#use-rules-to-add-jobs
|
# https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html#use-rules-to-add-jobs
|
||||||
|
|
||||||
|
.limit_pipelines:
|
||||||
|
rules:
|
||||||
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'
|
||||||
|
when: on_success
|
||||||
|
- when: never
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- local: /backend/backend/.gitlab-ci.yml
|
- local: /backend/backend/.gitlab-ci.yml
|
||||||
- local: /frontend/app/.gitlab-ci.yml
|
- local: /frontend/app/.gitlab-ci.yml
|
||||||
- local: /.gitlab/schedules.gitlab-ci.yml
|
- local: /.gitlab/schedules.gitlab-ci.yml
|
||||||
- local: /.gitlab/publishing.gitlab-ci.yml
|
- local: /.gitlab/publishing.gitlab-ci.yml
|
||||||
rules:
|
|
||||||
- if: '$CI_COMMIT_MESSAGE =~ /ci: publish release$/'
|
|
||||||
when: always
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
TURBO_CACHE_BYPASS:
|
TURBO_CACHE_BYPASS:
|
||||||
@@ -83,6 +87,7 @@ build:
|
|||||||
- if: $CI_COMMIT_BRANCH == 'develop'
|
- if: $CI_COMMIT_BRANCH == 'develop'
|
||||||
variables:
|
variables:
|
||||||
DEPLOY_ID: staging
|
DEPLOY_ID: staging
|
||||||
|
- !reference [.limit_pipelines, rules]
|
||||||
|
|
||||||
stop review:
|
stop review:
|
||||||
stage: build
|
stage: build
|
||||||
@@ -121,15 +126,15 @@ unit:
|
|||||||
coverage_format: cobertura
|
coverage_format: cobertura
|
||||||
path: coverage.xml
|
path: coverage.xml
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'
|
- !reference [.limit_pipelines, rules]
|
||||||
|
|
||||||
audit:
|
audit:
|
||||||
stage: audit
|
stage: audit
|
||||||
|
allow_failure: true
|
||||||
needs: []
|
needs: []
|
||||||
script:
|
script:
|
||||||
- pnpm audit --prod
|
- pnpm audit --prod
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'develop'
|
|
||||||
allow_failure: true
|
|
||||||
- if: $CI_COMMIT_BRANCH == 'main'
|
- if: $CI_COMMIT_BRANCH == 'main'
|
||||||
allow_failure: false
|
allow_failure: false
|
||||||
|
- !reference [.limit_pipelines, rules]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.limit_publishing:
|
.limit_publish_pipelines:
|
||||||
- if: $CI_PIPELINE_SOURCE != "schedule"
|
rules:
|
||||||
when: on_success
|
- if: '($CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop") && $CI_COMMIT_MESSAGE =~ /ci: publish release/ && $CI_PIPELINE_SOURCE != "schedule"'
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
stage: publish
|
stage: publish
|
||||||
@@ -12,7 +12,8 @@ deploy:
|
|||||||
paths:
|
paths:
|
||||||
- ./.deploy
|
- ./.deploy
|
||||||
- ./frontend/app/www
|
- ./frontend/app/www
|
||||||
rules: !reference [.limit_publishing]
|
rules:
|
||||||
|
- !reference [.limit_publish_pipelines, rules]
|
||||||
|
|
||||||
publish image:
|
publish image:
|
||||||
stage: publish
|
stage: publish
|
||||||
@@ -23,14 +24,15 @@ publish image:
|
|||||||
image:
|
image:
|
||||||
name: gcr.io/kaniko-project/executor:v1.12.1-debug
|
name: gcr.io/kaniko-project/executor:v1.12.1-debug
|
||||||
entrypoint: [""]
|
entrypoint: [""]
|
||||||
|
variables:
|
||||||
|
PUBLISH_TAG: next
|
||||||
script:
|
script:
|
||||||
- >
|
- >
|
||||||
/kaniko/executor
|
/kaniko/executor
|
||||||
--context "${CI_PROJECT_DIR}/${DEPLOY_DIR}"
|
--context "${CI_PROJECT_DIR}/${DEPLOY_DIR}"
|
||||||
--dockerfile "${CI_PROJECT_DIR}/${DEPLOY_DIR}/Dockerfile"
|
--dockerfile "${CI_PROJECT_DIR}/${DEPLOY_DIR}/Dockerfile"
|
||||||
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)"
|
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)"
|
||||||
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest"
|
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${PUBLISH_TAG}"
|
||||||
rules: !reference [.limit_publishing]
|
|
||||||
parallel:
|
parallel:
|
||||||
matrix:
|
matrix:
|
||||||
- IMAGE_NAME: database
|
- IMAGE_NAME: database
|
||||||
@@ -47,6 +49,11 @@ publish image:
|
|||||||
DEPLOY_DIR: .deploy/minimal-plugin
|
DEPLOY_DIR: .deploy/minimal-plugin
|
||||||
- IMAGE_NAME: app
|
- IMAGE_NAME: app
|
||||||
DEPLOY_DIR: frontend/app
|
DEPLOY_DIR: frontend/app
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH == 'main'
|
||||||
|
variables:
|
||||||
|
PUBLISH_TAG: latest
|
||||||
|
- !reference [.limit_publish_pipelines, rules]
|
||||||
|
|
||||||
publish packages:
|
publish packages:
|
||||||
stage: publish
|
stage: publish
|
||||||
@@ -54,18 +61,17 @@ publish packages:
|
|||||||
variables:
|
variables:
|
||||||
GIT_STRATEGY: clone
|
GIT_STRATEGY: clone
|
||||||
GIT_DEPTH: 0
|
GIT_DEPTH: 0
|
||||||
|
PUBLISH_TAG: next
|
||||||
script:
|
script:
|
||||||
- pnpm install
|
- pnpm install
|
||||||
- pnpm build
|
- pnpm build
|
||||||
- pnpm publish -r --publish-branch ${PUBLISH_BRANCH} --tag ${PUBLISH_TAG} --no-git-checks # TODO: Git checks...
|
- pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_AUTH_TOKEN}"
|
||||||
|
- pnpm publish -r --publish-branch ${CI_COMMIT_BRANCH} --tag ${PUBLISH_TAG} --no-git-checks # TODO: Git checks...
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_BRANCH == 'main'
|
- if: $CI_COMMIT_BRANCH == 'main'
|
||||||
variables:
|
variables:
|
||||||
PUBLISH_BRANCH: main
|
|
||||||
PUBLISH_TAG: latest
|
PUBLISH_TAG: latest
|
||||||
- variables:
|
- !reference [.limit_publish_pipelines, rules]
|
||||||
PUBLISH_BRANCH: $CI_COMMIT_BRANCH
|
|
||||||
PUBLISH_TAG: next
|
|
||||||
|
|
||||||
publish docs:
|
publish docs:
|
||||||
stage: publish
|
stage: publish
|
||||||
@@ -77,3 +83,6 @@ publish docs:
|
|||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH == 'main'
|
||||||
|
- !reference [.limit_publish_pipelines, rules]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.limit_base_image_publishing:
|
.limit_scheduled_pipelines:
|
||||||
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == 'main'
|
rules:
|
||||||
when: always
|
- if: $CI_COMMIT_BRANCH == 'main' && $CI_PIPELINE_SOURCE == "schedule"
|
||||||
|
|
||||||
base image:
|
base image:
|
||||||
image: docker
|
image: docker
|
||||||
@@ -21,7 +21,6 @@ base image:
|
|||||||
docker push "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}"
|
docker push "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}"
|
||||||
cache: {} # disable irrelevant cache for this job
|
cache: {} # disable irrelevant cache for this job
|
||||||
before_script: [] # do not run irrelevant before script for this job
|
before_script: [] # do not run irrelevant before script for this job
|
||||||
rules: !reference [.limit_base_image_publishing]
|
|
||||||
parallel:
|
parallel:
|
||||||
matrix:
|
matrix:
|
||||||
- IMAGE_NAME: node-base
|
- IMAGE_NAME: node-base
|
||||||
@@ -30,4 +29,5 @@ base image:
|
|||||||
DEPLOY_DIR: images/node-builder
|
DEPLOY_DIR: images/node-builder
|
||||||
- IMAGE_NAME: app-builder
|
- IMAGE_NAME: app-builder
|
||||||
DEPLOY_DIR: images/app-builder
|
DEPLOY_DIR: images/app-builder
|
||||||
|
rules:
|
||||||
|
- !reference [.limit_scheduled_pipelines, rules]
|
||||||
@@ -19,4 +19,4 @@ integration:
|
|||||||
junit:
|
junit:
|
||||||
- backend/backend/coverage/integration-report-junit.xml
|
- backend/backend/coverage/integration-report-junit.xml
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'
|
- !reference [.limit_pipelines, rules]
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ e2e:
|
|||||||
- BROWSER: chrome
|
- BROWSER: chrome
|
||||||
- BROWSER: firefox
|
- BROWSER: firefox
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'
|
- !reference [.limit_pipelines, rules]
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
"format:fix": "dotenv -c -- turbo run format:fix",
|
"format:fix": "dotenv -c -- turbo run format:fix",
|
||||||
"lint": "dotenv -c -- turbo run lint",
|
"lint": "dotenv -c -- turbo run lint",
|
||||||
"lint:fix": "dotenv -c -- turbo run lint:fix",
|
"lint:fix": "dotenv -c -- turbo run lint:fix",
|
||||||
"publish-packages": "pnpm changeset version && pnpm syncpack:fix && pnpm install && git add . && git commit -m \"refactor: update changelog\n\nci: publish release\" && git push && pnpm changeset tag && git push --follow-tags",
|
"publish-packages": "pnpm changeset version && pnpm syncpack:fix && pnpm install && git add . && git commit -m \"docs: update changelogs for release\n\nci: publish release\" && git push && pnpm changeset tag && git push --follow-tags",
|
||||||
"syncpack": "syncpack list-mismatches && syncpack lint-semver-ranges --types dev,peer,prod",
|
"syncpack": "syncpack list-mismatches && syncpack lint-semver-ranges --types dev,peer,prod",
|
||||||
"syncpack:fix": "syncpack format && syncpack fix-mismatches",
|
"syncpack:fix": "syncpack format && syncpack fix-mismatches",
|
||||||
"test": "trap 'node coverage.mjs' EXIT && dotenv -c -- turbo run test",
|
"test": "trap 'node coverage.mjs' EXIT && dotenv -c -- turbo run test",
|
||||||
|
|||||||
Reference in New Issue
Block a user