%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/cwg/wp-content/
Upload File :
Create Path :
Current File : /var/www/cwg/wp-content/bitbucket-pipelines.yml

image: atlassian/default-image:2

definitions:
  steps:
    - step: &buildDeployStep
        name: Build, Upload & Deploy
        image: node:16
        script:
          # setup
          - ARTIFACT_FILE="${BITBUCKET_REPO_SLUG}-${BITBUCKET_BRANCH}-${BITBUCKET_BUILD_NUMBER}.tgz"
          - wget -O /tmp/azcopy_v10.tar.gz https://aka.ms/downloadazcopy-v10-linux && tar -xvf /tmp/azcopy_v10.tar.gz -C /usr/bin --strip-components=1
          # build
          - cd ${BITBUCKET_CLONE_DIR}/themes/cwg
          - npm install
          - npm run production
          # update cache bust string
          - sed -i "s/^define('CACHE_BUST_STRING'.*/define('CACHE_BUST_STRING', '${BITBUCKET_BUILD_NUMBER}');/" functions.php
          # package
          - cd ${BITBUCKET_CLONE_DIR}       
          - tar -czf ${BITBUCKET_CLONE_DIR}/${ARTIFACT_FILE} --exclude-vcs --exclude-from=${BITBUCKET_CLONE_DIR}/artifact_exclude_list.txt *
          # transfer
          - azcopy make "${AZ_ARTIFACT_URL}/${BITBUCKET_REPO_SLUG}?${AZ_ARTIFACT_SAS}" || true
          - azcopy cp "${BITBUCKET_CLONE_DIR}/${ARTIFACT_FILE}" "${AZ_ARTIFACT_URL}/${BITBUCKET_REPO_SLUG}/?${AZ_ARTIFACT_SAS}"
          # deploy
          - ssh ${REMOTE_USER}@${REMOTE_HOST} "/home/${REMOTE_USER}/scripts/pipeline.sh ${BITBUCKET_REPO_SLUG} ${ARTIFACT_FILE}"

    - step: &deployStep
        name: Deploy
        script:
          # setup
          - ARTIFACT_FILE="${BITBUCKET_REPO_SLUG}-${BITBUCKET_BRANCH}-${BITBUCKET_BUILD_NUMBER}.tgz"        
          # deploy
          - ssh ${REMOTE_USER}@${REMOTE_HOST} "/home/${REMOTE_USER}/scripts/pipeline.sh ${BITBUCKET_REPO_SLUG} ${ARTIFACT_FILE}"

pipelines:
  branches:
    master:
      - step:
          <<: *buildDeployStep
          name: int - Build & Deploy
          deployment: integration
      - step:
          <<: *deployStep
          name: uat - Deploy
          deployment: uat
          trigger: manual
      - step:
          <<: *deployStep
          name: live - Deploy
          deployment: live
          trigger: manual

Zerion Mini Shell 1.0