Skip to content

Instantly share code, notes, and snippets.

@olopsman
Last active June 14, 2020 02:21
Show Gist options
  • Save olopsman/44c7866c05e65fe4c4e3e4bbd98c9d2d to your computer and use it in GitHub Desktop.
Save olopsman/44c7866c05e65fe4c4e3e4bbd98c9d2d to your computer and use it in GitHub Desktop.
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request:
branches: [ staging ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: 'Build and Deploy'
run: |
wget https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz
mkdir sfdx-cli
tar xJf sfdx-linux-amd64.tar.xz -C sfdx-cli --strip-components 1
./sfdx-cli/install
# Runs a set of commands using the runners shell
- name: 'Decrypt file'
run: openssl enc -nosalt -aes-256-cbc -d -in assets/server.key.enc -out server.key -base64 -K ${{secrets.DECRYPTION_KEY}} -iv ${{secrets.DECRYPTION_IV}}
- name: 'Authorize'
run: |
echo username value ${{ secrets.USERNAME_STAGING }}
sfdx force:auth:jwt:grant --clientid=${{ secrets.CONSUMER_KEY }} --username=${{ secrets.USERNAME }} --jwtkeyfile server.key --setdefaultdevhubusername --setalias=hub-org
- name: 'Convert Metadata'
run: sfdx force:source:convert --rootdir=force-app --outputdir=convert
- name: 'Run Test on Metadata'
run: sfdx force:mdapi:deploy --deploydir=convert --testlevel=RunLocalTests --checkonly -u hub-org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment