Skip to content

Instantly share code, notes, and snippets.

@sjurgis
Last active June 25, 2021 16:42
Show Gist options
  • Save sjurgis/2ff09c8045af0cd482d1e28529692120 to your computer and use it in GitHub Desktop.
Save sjurgis/2ff09c8045af0cd482d1e28529692120 to your computer and use it in GitHub Desktop.
name: sfdx test flow
on: [push]
jobs:
setup:
runs-on: ubuntu-latest
container: salesforce/salesforcedx
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install NPM modules
uses: bahmutov/npm-install@v1
with:
useLockFile: true
- shell: bash
run: |
# create.org is where your "sfdx force:auth:jwt:grant" flow lives
cd ci && ./create-org.sh && cd ..
zip -r ciorg.zip $PWD/.sfdx ~/.sfdx
- name: Save org
uses: actions/upload-artifact@v1
with:
name: ciorg
path: ciorg.zip
pass:
runs-on: ubuntu-latest
container: salesforce/salesforcedx
needs: setup
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install NPM modules
uses: bahmutov/npm-install@v1
with:
useLockFile: true
- name: Retrieve org
uses: actions/download-artifact@v1
with:
name: ciorg
- shell: bash
run: |
unzip -o ciorg/ciorg.zip -d /
- shell: bash
run: |
sfdx force:org:open -r
fail:
runs-on: ubuntu-latest
container: salesforce/salesforcedx
needs: setup
steps:
- shell: bash
run: |
exit 1
cleanup:
runs-on: ubuntu-latest
container: salesforce/salesforcedx
needs: [pass, fail]
if: always()
steps:
- name: Retrieve org
uses: actions/download-artifact@v1
with:
name: ciorg
- shell: bash
run: |
unzip -o ciorg/ciorg.zip -d /
- name: Delete org
run: sfdx force:org:delete -p -u ciorg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment