-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (69 loc) · 1.88 KB
/
build-and-publish.yaml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
name: Build Package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache pipenv dependencies
uses: actions/cache@v3
with:
path: |
~/.local/share/virtualenvs
~/.cache/pipenv
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pipenv-
- name: Install pipenv
run: |
python -m pip install pipenv
- name: Install dependencies
run: |
PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy --ignore-pipfile --dev
- name: Run tests
run: pipenv run python -m pytest
- name: Build
run: pipenv run python -m build
- name: Archive package artifacts
uses: actions/upload-artifact@v3
with:
name: python-package
path: dist/*
publish:
runs-on: ubuntu-latest
environment:
name: publish-approval
steps:
- name: Download pacakge artifacts
uses: actions/download-artifact@v3
with:
name: python-package
path: kaslcred-dist/
- name: List files in the current directory
run: |
ls -lah
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install twine
run: |
python -m pip install --upgrade pip
python -m pip install twine
- name: Publish
run: twine upload kaslcred-dist/*