|
| 1 | +name: Release upload |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +jobs: |
| 7 | + upload-release: |
| 8 | + if: | |
| 9 | + github.event_name == 'pull_request' && |
| 10 | + contains(github.head_ref, 'release') && |
| 11 | + github.event.pull_request.base.ref == 'main' |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 5 |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - sfra-version: 'v6.1.0' |
| 19 | + node-version: '14' |
| 20 | + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_004' |
| 21 | + code-version-secret: 'SFCC_CODE_VERSION_COMMON' |
| 22 | + - sfra-version: 'v6.1.0' |
| 23 | + node-version: '14' |
| 24 | + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_006' |
| 25 | + code-version-secret: 'SFCC_CODE_VERSION_COMMON' |
| 26 | + - sfra-version: 'v5.3.0' |
| 27 | + node-version: '14' |
| 28 | + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_007' |
| 29 | + code-version-secret: 'SFCC_CODE_VERSION_COMMON' |
| 30 | + - sfra-version: 'v5.3.0' |
| 31 | + node-version: '14' |
| 32 | + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_018' |
| 33 | + code-version-secret: 'SFCC_CODE_VERSION_COMMON' |
| 34 | + - sfra-version: 'v6.1.0' |
| 35 | + node-version: '14' |
| 36 | + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_019' |
| 37 | + code-version-secret: 'SFCC_CODE_VERSION_COMMON' |
| 38 | + - sfra-version: 'v6.1.0' |
| 39 | + node-version: '14' |
| 40 | + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_020' |
| 41 | + code-version-secret: 'SFCC_CODE_VERSION_COMMON' |
| 42 | + - sfra-version: 'v6.1.0' |
| 43 | + node-version: '14' |
| 44 | + sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_022' |
| 45 | + code-version-secret: 'SFCC_CODE_VERSION_COMMON' |
| 46 | + steps: |
| 47 | + - name: Checkout SFRA code |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + repository: SalesforceCommerceCloud/storefront-reference-architecture |
| 51 | + ref: ${{ matrix.sfra-version }} |
| 52 | + ssh-key: ${{ secrets.SERVICE_ACCOUNT_SSH_KEY }} |
| 53 | + path: storefront-reference-architecture |
| 54 | + - name: Setup Node.js |
| 55 | + uses: actions/setup-node@v3 |
| 56 | + with: |
| 57 | + node-version: ${{ matrix.node-version }} |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v4 |
| 60 | + with: |
| 61 | + path: adyen-salesforce-commerce-cloud |
| 62 | + - name: Install SFRA dependencies |
| 63 | + working-directory: storefront-reference-architecture |
| 64 | + run: npm install |
| 65 | + - name: Install Adyen SFCC dependencies |
| 66 | + working-directory: adyen-salesforce-commerce-cloud |
| 67 | + run: npm install |
| 68 | + - name: Create dw.json file |
| 69 | + working-directory: adyen-salesforce-commerce-cloud |
| 70 | + run: | |
| 71 | + echo '{ |
| 72 | + "username": "${{ secrets.SFCC_USERNAME }}", |
| 73 | + "password": "${{ secrets.SFCC_PASSWORD }}", |
| 74 | + "hostname": "${{ secrets[matrix.sfcc-hostname-secret] }}", |
| 75 | + "code-version": "${{ secrets[matrix.code-version-secret] }}" |
| 76 | + }' >> dw.json |
| 77 | + - name: Transpile the code |
| 78 | + working-directory: adyen-salesforce-commerce-cloud |
| 79 | + run: npm run transpile |
| 80 | + - name: Compile the code |
| 81 | + working-directory: adyen-salesforce-commerce-cloud |
| 82 | + run: npm run compile:js |
| 83 | + - name: Build the cartridge |
| 84 | + working-directory: adyen-salesforce-commerce-cloud |
| 85 | + run: npm run uploadCartridge > output-sfra.txt |
| 86 | + - name: Check build result |
| 87 | + working-directory: adyen-salesforce-commerce-cloud |
| 88 | + run: npm run check-build:sfra |
| 89 | + - name: Install Salesforce CLI |
| 90 | + run: | |
| 91 | + npm install -g sfcc-ci |
| 92 | + - name: Zip site_import |
| 93 | + working-directory: adyen-salesforce-commerce-cloud/metadata |
| 94 | + run: | |
| 95 | + zip -r $GITHUB_WORKSPACE/site_import.zip site_import |
| 96 | + - name: Upload the metadata to the sandbox |
| 97 | + working-directory: adyen-salesforce-commerce-cloud/metadata |
| 98 | + run: | |
| 99 | + sfcc-ci client:auth '${{ secrets.SFCC_CLIENT_ID }}' '${{ secrets.SFCC_CLIENT_SECRET }}' |
| 100 | + sfcc-ci instance:upload $GITHUB_WORKSPACE/site_import.zip -i "${{ secrets[matrix.sfcc-hostname-secret] }}" |
| 101 | + - name: Import the metadata to the sandbox |
| 102 | + working-directory: adyen-salesforce-commerce-cloud/metadata |
| 103 | + run: | |
| 104 | + sfcc-ci instance:import site_import.zip -i "${{ secrets[matrix.sfcc-hostname-secret] }}" -s |
0 commit comments