Skip to content

Commit

Permalink
feat: define middleware port and path (#27)
Browse files Browse the repository at this point in the history
* feat: add extra params for deploy action

* docs: update README.md
  • Loading branch information
grixu authored Aug 21, 2024
1 parent b48b7f3 commit b0df365
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ With those four you can easily compose the deployment script for your needs.
### build-frontend

```yaml
uses: vuestorefront/storefront-deployment/build-frontend@v1
uses: vuestorefront/storefront-deployment/build-frontend@v4.4.0
with:
project_name: ${{ secrets.PROJECT_NAME }}
cloud_username: ${{ secrets.CLOUD_USERNAME }}
Expand Down Expand Up @@ -49,7 +49,7 @@ Any environment variables needed by an application is needed to be set in the Al
### build-middleware

```yaml
uses: vuestorefront/storefront-deployment/build-middleware@v1
uses: vuestorefront/storefront-deployment/build-middleware@v4.4.0
with:
project_name: ${{ secrets.PROJECT_NAME }}
cloud_username: ${{ secrets.CLOUD_USERNAME }}
Expand Down Expand Up @@ -77,7 +77,7 @@ with:
### build-stripe-ct

```yaml
uses: vuestorefront/storefront-deployment/build-stripe-ct
uses: vuestorefront/storefront-deployment/build-stripe-ct@v4.4.0
with:
project_name: ${{ secrets.PROJECT_NAME }}
cloud_username: ${{ secrets.CLOUD_USERNAME }}
Expand Down Expand Up @@ -107,7 +107,7 @@ with:
### deploy

```yaml
uses: vuestorefront/storefront-deployment/deploy@v1
uses: vuestorefront/storefront-deployment/deploy@v4.4.0
with:
project_name: ${{ secrets.PROJECT_NAME }}
cloud_username: ${{ secrets.CLOUD_USERNAME }}
Expand All @@ -126,12 +126,14 @@ with:
- `cloud_region`: Region where the environment is set up in the Console. Required field.
- `docker_registry_url`: URL to the Docker image registry. Optional field. Defaults to `registry.vuestorefront.cloud`.
- `console_api_url`: URL to the Console. Optional field. Defaults to `https://api.platform.vuestorefront.io`.
- `version`: Docker image tag that will be deployed. Example: 2.3.0, 3.1.0-rc.1. If not passed, github.sha will be used
- `version`: Docker image tag that will be deployed. Example: 2.3.0, 3.1.0-rc.1. If not passed, `github.sha` will be used
- `middleware_path`: Path in URL of the Storefront on which Middleware app will be available. If not passed, `/api/` will be used
- `middleware_port`: Port on which Middleware application is working on. If not passed, `4000` will be used

### deploy/stripe-ct

```yaml
uses: vuestorefront/storefront-deployment/deploy/stripe-ct
uses: vuestorefront/storefront-deployment/deploy/stripe-ct@v4.4.0
with:
project_name: ${{ secrets.PROJECT_NAME }}
cloud_username: ${{ secrets.CLOUD_USERNAME }}
Expand All @@ -154,4 +156,4 @@ with:
- `extension_module_name`: Extension module name. It’s used as the name of the docker image and path where the api is available. Default value is `ct-stripe-extension`.
- `extension_module_port`: Port of the extension module. Default value is `8080`.
- `notification_module_name`: Notification module name. It’s used as the name of the docker image and path where the api is available. Default value is `ct-stripe-notification`.
- `notification_module_port`: Port of the notification module. Default value is `8081`.
- `notification_module_port`: Port of the notification module. Default value is `8081`.
10 changes: 9 additions & 1 deletion deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ inputs:
version:
description: "Version of the app"
required: false
middleware_path:
description: 'Path to the Middleware app on the Reverse Proxy'
required: false
default: '/api/'
middleware_port:
description: 'Port of the Middleware app'
required: false
default: 4000

runs:
using: "composite"
Expand All @@ -43,7 +51,7 @@ runs:
url: "${{ inputs.console_api_url }}/cloud/instances/${{ inputs.project_name }}-${{ inputs.cloud_region }}-gcp-storefrontcloud-io/deploy"
method: "PATCH"
customHeaders: '{"Content-Type":"application/json"}'
data: '{"middleware":true,"cloudUserId":"${{ inputs.cloud_username }}","cloudUserPassword":"${{ inputs.cloud_password }}","dockerImageHash":"${{ inputs.version || github.sha }}","env_var":{"03731de5-5ff9-49d9-a6e5-8af9c4fa75d9":{"name":"NUXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID","value":"${{ inputs.version || github.sha }}","is_secret":false},"03731de5-5ff9-49d9-a6e5-8af9c4fa75":{"name":"NEXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID","value":"${{ inputs.version || github.sha }}","is_secret":false}},"middlewareData":{"path":"/api/","port":4000,"has_base_path":false}}'
data: '{"middleware":true,"cloudUserId":"${{ inputs.cloud_username }}","cloudUserPassword":"${{ inputs.cloud_password }}","dockerImageHash":"${{ inputs.version || github.sha }}","env_var":{"03731de5-5ff9-49d9-a6e5-8af9c4fa75d9":{"name":"NUXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID","value":"${{ inputs.version || github.sha }}","is_secret":false},"03731de5-5ff9-49d9-a6e5-8af9c4fa75":{"name":"NEXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID","value":"${{ inputs.version || github.sha }}","is_secret":false}},"middlewareData":{"path":"${{ inputs.middleware_path }}","port":${{ inputs.middleware_port }},"has_base_path":false}}'
timeout: 60000

- name: Update deployment status (success)
Expand Down

0 comments on commit b0df365

Please sign in to comment.