Skip to content

Commit

Permalink
fix: pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
vermorag committed Jun 21, 2024
1 parent a9f6ea7 commit 6e9e097
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ variables:
ARTIFACTORY_REPO: "https://repo.cdek.ru/artifactory/erp-cms"

build_tag:
image: docker-proxy.cdek.ru/php:8.2-alpine
stage: build
tags:
- docker
only:
- tags
before_script:
- export COREPACK_NPM_REGISTRY="https://repo.cdek.ru/repository/cdek-npm"
- export RELEASE_VERSION=$(echo "${CI_COMMIT_TAG}" | sed 's/v//')
- sed -i 's/dl-cdn.alpinelinux.org/repo.cdek.ru\/repository/g' /etc/apk/repositories
- apk add nodejs-current yarn composer
- corepack enable
- corepack install -g --cache-only .yarn/corepack.tgz
script:
- sed -i "s/\(Version:\)\( *\).*/\1\2${RELEASE_VERSION}/" cdek.php
- sed -i "s/\(Stable tag:\)\( *\).*/\1\2${RELEASE_VERSION}/" readme.txt
Expand All @@ -34,6 +40,7 @@ build_tag:
- cdek.zip

build_custom:
image: docker-proxy.cdek.ru/php:8.2-alpine
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: always
Expand All @@ -46,6 +53,7 @@ build_custom:
paths:
- cdek.zip
before_script:
- !reference [build_tag, before_script]
- export RELEASE_VERSION="${CI_COMMIT_REF_NAME}#${CI_COMMIT_SHORT_SHA}"
script:
- !reference [build_tag, script]
Expand All @@ -63,7 +71,6 @@ upload:
- export RELEASE_VERSION=$(echo "${CI_COMMIT_TAG}" | sed 's/v//')
- export ARCHIVE_VERSION=$(echo "${RELEASE_VERSION}" | sed 's/\./_/g')
script:
- zip -r cdek.zip cdek
- curl -u "${ARTIFACTORY_LOGIN}":"${ARTIFACTORY_PASS}" --upload-file cdek.zip "${ARTIFACTORY_REPO}/$CI_PROJECT_NAME/$CI_COMMIT_BRANCH/wordpress_${ARCHIVE_VERSION}.zip"

release:
Expand All @@ -85,6 +92,7 @@ release:
deploy_staging:
stage: deploy
image: docker-proxy.cdek.ru/alpine
script:
- rsync -avz -e "ssh -o StrictHostKeyChecking=no" --delete ./cdek.zip ${DEPLOY_USERNAME}@${DEPLOY_NODE}:${DEPLOY_DEST_DIR}/plugins
- ssh ${DEPLOY_USERNAME}@${DEPLOY_NODE} "cd ${DEPLOY_DEST_DIR}/core && docker compose restart app"
Expand All @@ -101,12 +109,11 @@ deploy_staging:
name: dev2
url: https://wordpress-cms.dev2.cdek.ru
before_script:
- sed -i 's/dl-cdn.alpinelinux.org/repo.cdek.ru\/repository/g' /etc/apk/repositories
- test -r ~/.ssh || mkdir -p ~/.ssh
- 'command -v ssh-agent >/dev/null || ( apk update && apk add openssh-client )'
- 'command -v rsync >/dev/null || ( apk update && apk add rsync )'
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- eval $(ssh-agent -s)
- ssh-add ~/.ssh/id_rsa
- apk add curl zip
- zip -r cdek.zip cdek
Binary file added .yarn/corepack.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"volta": {
"node": "20.13.1",
"yarn": "4.2.2"
"yarn": "4.3.1"
},
"packageManager": "yarn@4.2.2"
"packageManager": "yarn@4.3.1"
}

0 comments on commit 6e9e097

Please sign in to comment.