From 37d116e88784c87006fd1b42522398e75ba852b4 Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 17 Sep 2024 14:52:10 -0400 Subject: [PATCH 1/6] Use uv rather than pip --- action.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 129dbd5..d9838e7 100644 --- a/action.yml +++ b/action.yml @@ -57,20 +57,16 @@ inputs: runs: using: composite steps: - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.10' + - uses: astral-sh/setup-uv@v2 - name: Install de-client shell: bash run: | - python -m pip install --upgrade pip if [ -z "${{ inputs.de_client_version }}" ]; then # If no version is specified, install the latest version - pip install de-client --extra-index-url=https://${{ inputs.DE_HOST }}/packages + uv pip install de-client --extra-index-url=https://${{ inputs.DE_HOST }}/packages else # Install the specified version - pip install de-client==${{ inputs.de_client_version }} --extra-index-url=https://${{ inputs.DE_HOST }}/packages + uv pip install de-client==${{ inputs.de_client_version }} --extra-index-url=https://${{ inputs.DE_HOST }}/packages fi - name: Generate app name id: app_name From b66971d74f73867e052ae1f38e00c865c490a5ab Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 18 Sep 2024 15:22:10 -0400 Subject: [PATCH 2/6] Ensure we use the latest de-client --- action.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index d9838e7..82e03fe 100644 --- a/action.yml +++ b/action.yml @@ -48,12 +48,9 @@ inputs: de_client_version: description: Version of the Dash Enterprise client to install. If not provided, the latest version will be installed. required: false - default: '' + default: "" type: string - - - runs: using: composite steps: @@ -63,7 +60,7 @@ runs: run: | if [ -z "${{ inputs.de_client_version }}" ]; then # If no version is specified, install the latest version - uv pip install de-client --extra-index-url=https://${{ inputs.DE_HOST }}/packages + uv pip install de-client --extra-index-url=https://${{ inputs.DE_HOST }}/packages --upgrade else # Install the specified version uv pip install de-client==${{ inputs.de_client_version }} --extra-index-url=https://${{ inputs.DE_HOST }}/packages @@ -162,7 +159,6 @@ runs: DASH_ENTERPRISE_HOST: ${{inputs.DE_HOST}} DASH_ENTERPRISE_USERNAME: ${{inputs.DE_USERNAME}} - branding: icon: activity color: purple From 7efa6a85cd174cc4b8ed4134013264ab3aad10f5 Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 18 Sep 2024 15:24:14 -0400 Subject: [PATCH 3/6] Change from 'none' to 'latest' --- README.md | 2 +- action.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dd844c2..5bab6d1 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ The inputs this action uses are: | `create_redis` | `false` | None | True to create a Redis instance for the app. | | `create_postgres` | `false` | None | True to create a Postgres instance for the app. | | `create_persistent_filesystem` | `false` | None | True to create a persistent filesystem for the app. | -| `de_client_version` | `false` | None | Version of the Dash Enterprise client to install. If not provided, the latest version will be installed. | +| `de_client_version` | `false` | 'latest' | Version of the Dash Enterprise client to install. By default, the latest version will be installed. | ### Preview deploy on pull request This action will deploy branches using the `on: pull_request: types: ['opened', 'edited', 'synchronize', 'closed']` trigger as `https://${DE_HOST}/${APP_NAME}-${event_number}`, e.g. if you are deploying an app called `inventory-analytics` to `example.plotly.host` and your PR number is `15`, the deploy preview would be available at `https://example.plotly.host/inventory-analytics-15` and would be redeployed on every new commit to that PR. diff --git a/action.yml b/action.yml index 82e03fe..f41b7d0 100644 --- a/action.yml +++ b/action.yml @@ -48,7 +48,7 @@ inputs: de_client_version: description: Version of the Dash Enterprise client to install. If not provided, the latest version will be installed. required: false - default: "" + default: "latest" type: string runs: @@ -58,7 +58,7 @@ runs: - name: Install de-client shell: bash run: | - if [ -z "${{ inputs.de_client_version }}" ]; then + if [ "${{ inputs.de_client_version }}" = "latest" ]; then # If no version is specified, install the latest version uv pip install de-client --extra-index-url=https://${{ inputs.DE_HOST }}/packages --upgrade else From 77623a09a038acb00218d2b121ca78c8f56f2ce4 Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 18 Sep 2024 16:01:17 -0400 Subject: [PATCH 4/6] Use a venv --- action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/action.yml b/action.yml index f41b7d0..fd9fe96 100644 --- a/action.yml +++ b/action.yml @@ -58,6 +58,8 @@ runs: - name: Install de-client shell: bash run: | + uv venv + source .venv/bin/activate if [ "${{ inputs.de_client_version }}" = "latest" ]; then # If no version is specified, install the latest version uv pip install de-client --extra-index-url=https://${{ inputs.DE_HOST }}/packages --upgrade From c90723592aadebaf1b92fdeb7115d77556418d5f Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 18 Sep 2024 16:03:00 -0400 Subject: [PATCH 5/6] Allow packages from multiple indices --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index fd9fe96..4136ec5 100644 --- a/action.yml +++ b/action.yml @@ -62,10 +62,10 @@ runs: source .venv/bin/activate if [ "${{ inputs.de_client_version }}" = "latest" ]; then # If no version is specified, install the latest version - uv pip install de-client --extra-index-url=https://${{ inputs.DE_HOST }}/packages --upgrade + uv pip install de-client --extra-index-url=https://${{ inputs.DE_HOST }}/packages --upgrade --index-strategy unsafe-any-match else # Install the specified version - uv pip install de-client==${{ inputs.de_client_version }} --extra-index-url=https://${{ inputs.DE_HOST }}/packages + uv pip install de-client==${{ inputs.de_client_version }} --extra-index-url=https://${{ inputs.DE_HOST }}/packages --index-strategy unsafe-any-match fi - name: Generate app name id: app_name From 3a0cb5f133d8b2aaa6e64b8d18638f20faed6beb Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 18 Sep 2024 16:06:19 -0400 Subject: [PATCH 6/6] Activate venv at steps using de --- action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/action.yml b/action.yml index 4136ec5..31ef385 100644 --- a/action.yml +++ b/action.yml @@ -87,6 +87,7 @@ runs: - name: Create app if it does not exist shell: bash run: | + source .venv/bin/activate # Create the app if it does not already exist exists=$(de --no-keyfile apps exists -n $APP_NAME) if [[ $exists == *"App [$APP_NAME] does not exist on [$DASH_ENTERPRISE_HOST]."* ]]; then @@ -112,6 +113,7 @@ runs: shell: bash if: ${{ inputs.create_redis }} run: | + source .venv/bin/activate exists=$(de --no-keyfile services exists -n ${{ steps.app_name.outputs.app_name }} -t redis) if [[ $exists == "False" ]]; then de --no-keyfile services create --app-name ${{ steps.app_name.outputs.app_name }} --type redis @@ -124,6 +126,7 @@ runs: shell: bash if: ${{ inputs.create_postgres }} run: | + source .venv/bin/activate exists=$(de --no-keyfile services exists -n ${{ steps.app_name.outputs.app_name }} -t postgres) if [[ $exists == "False" ]]; then de --no-keyfile services create --app-name ${{ steps.app_name.outputs.app_name }} --type postgres @@ -136,6 +139,7 @@ runs: shell: bash if: ${{ inputs.create_persistent_filesystem }} run: | + source .venv/bin/activate de --no-keyfile apps update -n ${{ steps.app_name.outputs.app_name }} --persistent-filesystem env: DASH_ENTERPRISE_HOST: ${{inputs.DE_HOST}} @@ -145,6 +149,7 @@ runs: shell: bash if: github.event.action != 'closed' run: | + source .venv/bin/activate de --no-keyfile deploy ${{ inputs.app_directory }} --name ${{ steps.app_name.outputs.app_name }} --message "Deployed commit: $GITHUB_SHA" -y de --no-keyfile apps update --name ${{ steps.app_name.outputs.app_name }} --add-group-co-owner "${{ inputs.group_co_owners }}" --add-group-viewer "${{ inputs.group_viewers }}" env: @@ -155,6 +160,7 @@ runs: shell: bash if: github.event.action == 'closed' run: | + source .venv/bin/activate de --no-keyfile apps delete --name ${{ steps.app_name.outputs.app_name }} env: DASH_ENTERPRISE_PASSWORD: ${{inputs.DE_PASSWORD}}