summaryrefslogtreecommitdiff
path: root/.github/workflows/requirements.yml
blob: 7c24d4c9380f6b1634932c5689ee5e3188f568ac (plain)
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
name: Generate Requirements

on:
  workflow_dispatch:
  
  push:
    paths:
      - poetry.lock
      - pyproject.toml
      - requirements.txt

jobs:
  generate:
    name: Requirements
    runs-on: ubuntu-latest
    
    steps:
      - uses: actions/checkout@v2
      
      - uses: actions/setup-python@v2
        with:
          python-version: 3.8
      
      - uses: Gr1N/setup-poetry@v4
        with:
          path: ~/.cache/pypoetry
          key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
          restore-keys: ${{ runner.os }}-poetry-
      
      - name: Generate dependencies
        run: |
          poetry export -f requirements.txt -o requirements.txt
      
      - name: Push to repository
        run: |
          [[ -z "$(git status -s)" ]] && exit
          git config user.name github-action
          git config user.email [email protected]
          git add requirements.txt
          git commit -am ":pushpin: Update requirements.txt"
          git push