Code Monkey home page Code Monkey logo

sfdx-deploy's Introduction

Salesforce Deploy Action

Salesforce Deploy is a lightweight GitHub Action that allows you to quickly and safely automate your Salesforce build, test and deploy pipeline using GitHub Workflows.

Uses the Salesforce CLI to create a manifest from one or more local directories that contain source files by running the force:source:convert command and runs the force:source:deploy command to test in and deploy to a target environment.

Supports both pre and post destructive changes.

Usage

- uses: actions/sfdx-deploy
  env:
    # Username or alias for the target org. Must be pre-authorized.
    # Required
    TARGET_USERNAME: ""

    # Comma-separated list of paths to the local source files to include in the manifest.
    # Default value: force-app
    SOURCE_PATH: ""

    # Path to folder containing manifests (destructiveChangesPre.xml, destructiveChangesPost.xml)
    # of components to delete before and/or after the deploy.
    # Default value: destructive-changes
    DESTRUCTIVE_CHANGES: ""

    # Specifies which level of deployment tests to run.
    # Default value: RunLocalTests
    TEST_LEVEL: ""

    # Number of minutes to wait for the command to complete and display results to the terminal window.
    # Default value: 33
    WAIT: ""

Outputs

  • DEPLOYED: Boolean value that identifies if the deployment was successful.
  • DESTRUCTIVE_CHANGES: Boolean value that identifies if destructive changes were present.

Example Workflow

on:
  push:
    branches:
      - "master"
name: Deploy to Salesforce Production
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: "14"

      - name: Cache node modules
        uses: actions/cache@v3
        id: npm_cache_id
        with:
          path: node_modules
          key: ${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-npm-cache-
            ${{ runner.os }}-

      - name: Install Dependencies
        if: steps.npm_cache_id.outputs.cache-hit != 'true'
        run: npm ci

      - name: SFDX Auth
        env:
          SFDX_JWT_KEY: ${{ secrets.SFDX_JWT_KEY }}
          SFDX_CLIENT_ID: ${{ secrets.SFDX_CLIENT_ID }}
        run: |
          echo "${SFDX_JWT_KEY}" > server.key
          npx sfdx force:auth:jwt:grant --clientid "${SFDX_CLIENT_ID}" --jwtkeyfile server.key --username [email protected] --setdefaultdevhubusername
          npx sfdx force:org:display --json -u [email protected] > sfdx-auth.json
          rm server.key

      - name: Build, Test & Deploy
        uses: gfarb/sfdx-deploy@v1
        env:
          TARGET_USERNAME: [email protected]
          SOURCE_PATH: force-app
          DESTRUCTIVE_CHANGES: destructive-changes
          TEST_LEVEL: RunLocalTests
          WAIT: 200

Resources

License

MIT

sfdx-deploy's People

Contributors

gfarb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.