Circle CI custom deployment script

Hi :wave: , I’m new to Circle CI, I’d like to know if this is possible

example of Travis CI

deploy:
provider: script # Run a custom deployment script which we will define below
script: now --token $NOW_TOKEN
skip_cleanup: true
on:
all_branches: true
master: false
provider: script
script: now --token $NOW_TOKEN && now alias --token $NOW_TOKEN
skip_cleanup: true
on:
master: true

a specific script is executed for the master branch and another any other non-master branch. I tried to do it with Circle CI, but the 2 jobs were executed at the same time, that’s not the result I want.

have a nice day :slight_smile:

my config circle

Javascript Node CircleCI 2.0 configuration file

Check https://circleci.com/docs/2.0/language-javascript/ for more details

version: 2
jobs:

deployment in development mode

build:
docker:
- image: circleci/node:latest-browsers # basically tells Circle to use Node.js docker runner to deploy the app to Now on every push
working_directory: ~/repo
steps: # A list of steps to be performed
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum “package.json” }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

  - run: yarn install
  - run: sudo yarn global add now --no-save  # Install Now CLI on GitLab CI
  - save_cache:
      paths:
        - node_modules
      key: v1-dependencies-{{ checksum "package.json" }}

  # run deploy !! :)
  - run: now -p -t $NOW_TOKEN
branches: 
  ignore:
    - master

(Hi there. Would you apply Markdown code formatting to your YAML, by editing your post, so that we can understand its structure? Thanks!)

1 Like
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
  # deployment in development mode 
  build:
    docker:
      - image: circleci/node:latest-browsers # basically tells Circle to use Node.js docker runner to deploy the app to Now on every push
    working_directory: ~/repo
    steps: # A list of steps to be performed
      - checkout
      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: yarn install
      - run: sudo yarn global add now --no-save  # Install Now CLI on GitLab CI
      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run deploy !! :)
      - run: now -p -t $NOW_TOKEN
    branches: 
      ignore:
        - master
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.