-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
58 lines (47 loc) · 1.5 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: "Artisanal Poetry Install"
author: "Daniel Knell"
description: "Install python dependencies with poetry"
branding:
icon: "arrow-down-circle"
color: "purple"
inputs:
version:
description: "poetry version to install"
type: "string"
required: false
directory:
description: "working directory of the project"
type: "string"
required: false
default: "."
extras:
description: "python extras to install"
type: "string"
required: false
runs:
using: "composite"
steps:
- name: install poetry
run: curl -sSL https://install.python-poetry.org | python - ${{ inputs.version && format('--version "{0}"', inputs.version) }}
shell: bash
- name: update path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: configure poetry
run: poetry config virtualenvs.in-project true
shell: bash
- name: set up cache
uses: actions/cache@v4
with:
path: ${{ inputs.directory }}/.venv
key: venv-${{ hashFiles('**/poetry.lock') }}-${{ inputs.extras }}-${{ inputs.directory }}
id: cache
- name: ensure cache is healthy
run: timeout 10s poetry run pip --version || rm -rf .venv
shell: bash
working-directory: ${{ inputs.directory }}
if: steps.cache.outputs.cache-hit == 'true'
- name: install dependencies
run: poetry install ${{ inputs.extras && format('--extras "{0}"', inputs.extras) }}
shell: bash
working-directory: ${{ inputs.directory }}