Merge pull request #4 from adobe-commerce/feature/ai-tooling #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Mesh | |
| # Controls when the workflow will run | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the "main" branch | |
| push: | |
| branches: ["main"] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| deploy: | |
| name: Deploy to Prod | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| max-parallel: 1 | |
| matrix: | |
| node-version: ["20"] | |
| os: [ubuntu-latest] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Validate Secrets | |
| run: | | |
| if | |
| [ -z "${{ secrets.CLIENTID }}" ] || | |
| [ -z "${{ secrets.CLIENTSECRET }}" ] || | |
| [ -z "${{ secrets.TECHNICALACCID }}" ] || | |
| [ -z "${{ secrets.TECHNICALACCEMAIL }}" ] || | |
| [ -z "${{ secrets.IMSORGID }}" ] || | |
| [ -z "${{ secrets.ORGID }}" ] || | |
| [ -z "${{ secrets.PROJECTID }}" ] || | |
| [ -z "${{ secrets.WORKSPACEID }}" ]; then | |
| echo "Please set all required secrets: CLIENTID, CLIENTSECRET, TECHNICALACCID, TECHNICALACCEMAIL, IMSORGID, ORGID, PROJECTID, WORKSPACEID" | |
| exit 1 | |
| fi | |
| - name: Setup CLI | |
| uses: adobe/aio-cli-setup-action@1.3.0 | |
| with: | |
| os: ${{ matrix.os }} | |
| version: 10.x.x | |
| - name: api-mesh-plugin install | |
| run: aio plugins:install @adobe/aio-cli-plugin-api-mesh | |
| - name: Auth | |
| uses: adobe/aio-apps-action@3.3.0 | |
| with: | |
| os: ${{ matrix.os }} | |
| command: oauth_sts | |
| CLIENTID: ${{ secrets.CLIENTID }} | |
| CLIENTSECRET: ${{ secrets.CLIENTSECRET }} | |
| TECHNICALACCOUNTID: ${{ secrets.TECHNICALACCID }} | |
| TECHNICALACCOUNTEMAIL: ${{ secrets.TECHNICALACCEMAIL }} | |
| IMSORGID: ${{ secrets.IMSORGID }} | |
| SCOPES: AdobeID, openid, read_organizations, additional_info.projectedProductContext, additional_info.roles, adobeio_api, read_client_secret, manage_client_secrets | |
| - name: Set CLI ENV | |
| run: aio config set cli.env prod | |
| - name: Select org | |
| run: aio console:org:select ${{ secrets.ORGID }} | |
| - name: Select project | |
| run: aio console:project:select ${{ secrets.PROJECTID }} | |
| - name: Select workspace | |
| run: aio console:workspace:select ${{ secrets.WORKSPACEID }} | |
| - name: Print AIO CLI Config | |
| run: aio config list | |
| - name: Get Mesh | |
| id: get_mesh | |
| continue-on-error: true | |
| run: | | |
| output=$(aio api-mesh:get 2>&1) | |
| # Escape the output and replace newlines with %0A | |
| escaped_output=$(echo "$output" | tr -d '\r' | tr '\n' ' ') | |
| echo "mesh_output=$escaped_output" >> $GITHUB_OUTPUT | |
| echo "$output" | |
| - name: Debug Get Mesh Output | |
| continue-on-error: true | |
| run: echo "Get Mesh Output - ${{ steps.get_mesh.outputs.mesh_output }}" | |
| - name: Create Mesh | |
| if: ${{ contains(steps.get_mesh.outputs.mesh_output, 'No mesh found') }} | |
| run: aio api-mesh:create -c mesh.json --env .env | |
| - name: Update Mesh | |
| if: ${{ !contains(steps.get_mesh.outputs.mesh_output, 'No mesh found') }} | |
| run: aio api-mesh:update -c mesh.json --env .env | |
| - name: Wait for 30 seconds | |
| run: sleep 30 | |
| - name: Describe Mesh | |
| run: aio api-mesh:describe | |
| - name: Get Mesh Status | |
| run: aio api-mesh:status |