From 48a3f5b5a97cb7f15fadaa421e599de0ba71b0a9 Mon Sep 17 00:00:00 2001 From: Chris Payne <2872984+paynecrl97@users.noreply.github.com> Date: Wed, 1 Mar 2023 17:43:57 +0000 Subject: [PATCH] Adds support for OrgFlow v2 (#4) --- .github/workflows/build.yml | 2 +- .github/workflows/test.yml | 13 +++++++------ README.md | 8 ++++---- dist/main.js | 7 ++++++- lib/cli.ts | 10 +++++++++- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1968d8c..05cc8f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install run: | npm i -g @vercel/ncc diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b4294ed..00c9d80 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: setup_job: runs-on: ubuntu-latest - container: orgflow/cli:1.4.x + container: orgflow/cli:2.x name: Setup outputs: stack-name: ${{ steps.create_stack.outputs.stack-name }} @@ -22,8 +22,8 @@ jobs: run: | mkdir /tmp/$STACKNAME git init --bare -b main /tmp/$STACKNAME - orgflow stack:create --name=$STACKNAME --gitRepoUrl=/tmp/$STACKNAME --username=${{ secrets.SALESFORCE_USERNAME }} --password=${{ secrets.SALESFORCE_PASSWORD }} --licenseKey=${{ secrets.ORGFLOW_LICENSEKEY }} --acceptEula - echo "::set-output name=stack-name::$STACKNAME" + orgflow stack:create --name=$STACKNAME --gitRepoUrl=/tmp/$STACKNAME --username='${{ secrets.SALESFORCE_USERNAME }}' --password='${{ secrets.SALESFORCE_PASSWORD }}' --licenseKey=${{ secrets.ORGFLOW_LICENSEKEY }} --acceptEula + echo "stack-name=$STACKNAME" >> $GITHUB_OUTPUT env: STACKNAME: TestStack_${{ github.run_id }}_${{ github.run_number }} @@ -34,15 +34,16 @@ jobs: strategy: matrix: image: [ubuntu-latest, macos-latest, windows-latest] + version: [1, 2] fail-fast: false steps: - name: Checkout source - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up OrgFlow uses: ./ id: setup with: - version: "1.4" + version: ${{ matrix.version }} license-key: ${{ secrets.ORGFLOW_LICENSEKEY }} salesforce-username: ${{ secrets.SALESFORCE_USERNAME }} salesforce-password: ${{ secrets.SALESFORCE_PASSWORD }} @@ -62,7 +63,7 @@ jobs: teardown_job: runs-on: ubuntu-latest - container: orgflow/cli:1.4.x + container: orgflow/cli:2.x name: Teardown needs: [setup_job, test_job] if: ${{ always() }} diff --git a/README.md b/README.md index e398b7f..f54d1a3 100644 --- a/README.md +++ b/README.md @@ -91,17 +91,17 @@ jobs: - run: orgflow stack:list ``` -Install latest 1.3.x version, save Salesforce credentials and flow metadata changes from one sandbox environment to another: +Install latest 2.0.x version, save Salesforce credentials and flow metadata changes from one sandbox environment to another: ```yaml jobs: orgflow_job: runs-on: ubuntu-latest steps: - # Download and install latest 1.3.x version + # Download and install latest 2.0.x version - uses: orgflow-actions/setup@v1 with: - version: "1.3" + version: "2.0" license-key: ${{ secrets.ORGFLOW_LICENSEKEY }} salesforce-username: ${{ secrets.SALESFORCE_USERNAME }} salesforce-password: ${{ secrets.SALESFORCE_PASSWORD }} @@ -216,7 +216,7 @@ For most public Git services such as GitHub, Azure Repos, BitBucket etc., you wo All of our `orgflow-actions/*` actions are semantically versioned. Breaking changes will cause a major version bump. -All releases are tagged with a full version number, e.g. `v1.0.0`. You can use these tags to pin your workflow to a specific release, e.g. `@v1.0.0`. +All releases are tagged with a full version number, e.g. `v1.1.0`. You can use these tags to pin your workflow to a specific release, e.g. `@v1.1.0`. We also maintain branches for each major version of our actions, and you can reference branch names to ensure that you are using the most up to date version of this action for a specific major version. For example `@v1` would cause your workflow to automatically use the most up to date `v1.x.x` version of this action. diff --git a/dist/main.js b/dist/main.js index fe8a8dd..1a4e679 100644 --- a/dist/main.js +++ b/dist/main.js @@ -15666,7 +15666,12 @@ exports.setLicenseKey = setLicenseKey; function createEncryptionKey() { return __awaiter(this, void 0, void 0, function* () { core.debug("Creating new encryption key..."); - const encryptionKey = yield execOrgFlow("auth:key:create", "--output=flat"); + const version = yield getInstalledVersion(); + const useFlatOutput = version.startsWith("1."); + core.debug(`Version: ${version}, use flat output: ${useFlatOutput}.`); + const encryptionKey = useFlatOutput + ? yield execOrgFlow("auth:key:create", "--output=flat") + : yield execOrgFlow("auth:key:create"); core.debug("New encryption key was successfully created."); return encryptionKey; }); diff --git a/lib/cli.ts b/lib/cli.ts index efddf43..d2435d8 100644 --- a/lib/cli.ts +++ b/lib/cli.ts @@ -50,7 +50,15 @@ export async function createEncryptionKey() { core.debug("Creating new encryption key..."); - const encryptionKey = await execOrgFlow("auth:key:create", "--output=flat"); + const version = await getInstalledVersion(); + const useFlatOutput = version.startsWith("1."); + + core.debug(`Version: ${version}, use flat output: ${useFlatOutput}.`); + + const encryptionKey = + useFlatOutput + ? await execOrgFlow("auth:key:create", "--output=flat") + : await execOrgFlow("auth:key:create"); core.debug("New encryption key was successfully created.");