Ajout FishPeper
This commit is contained in:
107
cncjs/.circleci/config.yml
Normal file
107
cncjs/.circleci/config.yml
Normal file
@@ -0,0 +1,107 @@
|
||||
# https://circleci.com/blog/persisting-data-in-workflows-when-to-use-caching-artifacts-and-workspaces/
|
||||
|
||||
version: 2.1
|
||||
|
||||
orbs:
|
||||
browser-tools: circleci/browser-tools@1.1.3
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build-n-deploy:
|
||||
jobs:
|
||||
- build
|
||||
- deploy:
|
||||
requires:
|
||||
- build
|
||||
|
||||
# https://circleci.com/docs/2.0/executor-types/
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: cimg/node:12.22-browsers
|
||||
steps:
|
||||
- browser-tools/install-browser-tools
|
||||
- run:
|
||||
name: Configuration
|
||||
command: |
|
||||
npm config set loglevel warn
|
||||
npm config set scripts-prepend-node-path auto
|
||||
- checkout
|
||||
- run:
|
||||
name: Setup environment variables
|
||||
command: |
|
||||
echo "export CI_BRANCH=${CIRCLE_BRANCH}" >> $BASH_ENV
|
||||
echo "export CI_BUILD_NUMBER=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
||||
echo "export CI_COMMIT=${CIRCLE_SHA1}" >> $BASH_ENV
|
||||
echo "export CI_COMMIT_SHORT=${CIRCLE_SHA1:0:8}" >> $BASH_ENV
|
||||
echo "export CI_TAG=${CIRCLE_TAG}" >> $BASH_ENV
|
||||
- run:
|
||||
name: Install system packages
|
||||
command: |
|
||||
sudo apt-get update
|
||||
- run:
|
||||
name: Check version
|
||||
command: |
|
||||
git --version
|
||||
node --version
|
||||
java --version
|
||||
google-chrome --version
|
||||
npm --version
|
||||
yarn --version
|
||||
- run:
|
||||
name: Install packages
|
||||
command: |
|
||||
yarn
|
||||
- run:
|
||||
name: Build
|
||||
command: |
|
||||
yarn clean
|
||||
yarn lint
|
||||
yarn test
|
||||
if [[ -z "$CI_TAG" ]]; then
|
||||
yarn build-latest
|
||||
else
|
||||
yarn build
|
||||
fi
|
||||
- run:
|
||||
name: Archive build artifacts
|
||||
command: |
|
||||
tar -zcvf ci.tar.gz --directory dist cncjs
|
||||
- persist_to_workspace:
|
||||
# Must be an absolute path, or relative path from working_directory.
|
||||
# This is a directory on the container which is taken to be the root directory of the workspace.
|
||||
root: .
|
||||
paths:
|
||||
- ci.tar.gz
|
||||
deploy:
|
||||
docker:
|
||||
- image: cimg/node:12.22
|
||||
steps:
|
||||
- setup_remote_docker:
|
||||
version: 19.03.13
|
||||
- checkout
|
||||
- run:
|
||||
name: Setup environment variables
|
||||
command: |
|
||||
echo "export CI_BRANCH=${CIRCLE_BRANCH}" >> $BASH_ENV
|
||||
- attach_workspace:
|
||||
# Must be absolute path or relative path from working_directory
|
||||
at: workspace
|
||||
- run:
|
||||
name: Extract build artifacts
|
||||
command: |
|
||||
mkdir -p dist
|
||||
tar zxvf workspace/ci.tar.gz --directory dist
|
||||
- run:
|
||||
name: Build Docker image
|
||||
command: |
|
||||
DOCKER_BRANCH_TAG=$(echo $CI_BRANCH | sed -e 's/\//-/g')
|
||||
DOCKER_REPO=cncjs/cncjs
|
||||
|
||||
echo "DOCKER_BRANCH_TAG=$DOCKER_BRANCH_TAG"
|
||||
echo "DOCKER_REPO=$DOCKER_REPO"
|
||||
|
||||
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
docker build -f Dockerfile -t $DOCKER_REPO:$DOCKER_BRANCH_TAG .
|
||||
docker images
|
||||
docker push $DOCKER_REPO:$DOCKER_BRANCH_TAG
|
||||
Reference in New Issue
Block a user