Skip to content

Use uv rather than pip #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
26 changes: 13 additions & 13 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,24 @@ 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:
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
uv venv
source .venv/bin/activate
if [ "${{ inputs.de_client_version }}" = "latest" ]; 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 --upgrade --index-strategy unsafe-any-match
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 --index-strategy unsafe-any-match
fi
- name: Generate app name
id: app_name
Expand All @@ -92,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
Expand All @@ -117,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
Expand All @@ -129,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
Expand All @@ -141,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}}
Expand All @@ -150,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:
Expand All @@ -160,13 +160,13 @@ 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}}
DASH_ENTERPRISE_HOST: ${{inputs.DE_HOST}}
DASH_ENTERPRISE_USERNAME: ${{inputs.DE_USERNAME}}


branding:
icon: activity
color: purple