Change .gitlab-ci for new release workflow

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-06-21 10:15:05 +02:00
parent 4ebb5630e3
commit 83dabfcd70
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -252,34 +252,45 @@ package-app-dev:
release-upload: release-upload:
stage: upload stage: upload
image: curlimages/curl:latest image: framasoft/yakforms-assets-deploy:latest
rules: only:
- if: $CI_COMMIT_TAG variables:
script: | - $CI_COMMIT_TAG
APP_VERSION="${CI_COMMIT_TAG}" - $DEPLOYEMENT_KEY
APP_ASSET="${CI_PROJECT_NAME}_${APP_VERSION}_${ARCH}.tar.gz" - $DEPLOYEMENT_USER
- $DEPLOYEMENT_HOST
script:
- APP_VERSION="${CI_COMMIT_TAG}"
- APP_ASSET="${CI_PROJECT_NAME}_${APP_VERSION}_${ARCH}.tar.gz"
echo "Artifact: ${APP_ASSET}" - 'echo "Artifact: ${APP_ASSET}"'
tar czf ${APP_ASSET} -C release mobilizon - tar czf ${APP_ASSET} -C release mobilizon
ls -al ${APP_ASSET} - ls -al ${APP_ASSET}
curl --silent --show-error --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "${APP_ASSET}" ${PACKAGE_REGISTRY_URL}/${APP_VERSION}/${APP_ASSET} - eval `ssh-agent -s`
- ssh-add <(echo "${DEPLOYEMENT_KEY}" | base64 --decode -i)
- echo "put -r ${APP_ASSET}" | sftp -o "VerifyHostKeyDNS yes" ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:public/
artifacts: artifacts:
expire_in: 1 day expire_in: 1 day
when: on_success when: on_success
paths: paths:
- mobilizon_*.tar.gz - mobilizon_*.tar.gz
# release-create:
# stage: deploy
# image: registry.gitlab.com/gitlab-org/release-cli:latest
# rules:
# - if: $CI_COMMIT_TAG
# dependencies: []
# cache: {}
# script: |
# APP_VERSION="${CI_COMMIT_TAG}"
# APP_ASSET="${CI_PROJECT_NAME}_${APP_VERSION}_${ARCH}.tar.gz"
# release-cli create --name "$CI_PROJECT_TITLE v$CI_COMMIT_TAG" \ release-create:
# --tag-name "$CI_COMMIT_TAG" \ stage: deploy
# --assets-link "{\"name\":\"${APP_ASSET}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${APP_VERSION}/${APP_ASSET}\"}" image: registry.gitlab.com/gitlab-org/release-cli:latest
only:
variables:
- $CI_COMMIT_TAG
before_script:
- apk --no-cache add awk sed grep
script: |
APP_VERSION="${CI_COMMIT_TAG}"
APP_ASSET="${CI_PROJECT_NAME}_${APP_VERSION}_${ARCH}.tar.gz"
CHANGELOG=$(awk -v version="$APP_VERSION" '/^## / { printit = $2 == version }; printit' CHANGELOG.md | grep -v "## $APP_VERSION" | sed '1{/^$/d}')
ENDPOINT="https://packages.joinmobilizon.org"
release-cli create --name "$CI_PROJECT_TITLE v$CI_COMMIT_TAG" \
--description "$CHANGELOG" \
--tag-name "$CI_COMMIT_TAG" \
--assets-link "{\"name\":\"${APP_ASSET}\",\"url\":\"${ENDPOINT}/${APP_ASSET}\"}"