Repository navigation
66 lines (60 loc) · 2.05 KB
/
Copy pathdeploy.yml
File metadata and controls
66 lines (60 loc) · 2.05 KB
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
name: deploy
on:
release:
types:
- published
workflow_dispatch:
jobs:
deploy:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
python-version: ["3.9"]
operating-system: [windows-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create .pypirc file
shell: pwsh
run: |
@"
[distutils]
index-servers =
pypi
navigate-micro
[pypi]
repository: https://upload.pypi.org/legacy/
username: $env:PYPI_USERNAME
password: $env:PYPI_PASSWORD
[navigate-micro]
repository: https://upload.pypi.org/legacy/
username: $env:PYPI_USERNAME
password: $env:PYPI_PASSWORD
"@ | Set-Content -Path $env:USERPROFILE\.pypirc
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools build twine
- name: Sync version file with release tag
if: github.event_name == 'release'
shell: pwsh
run: |
$tag = $env:GITHUB_REF_NAME
if (-not $tag) { throw "GITHUB_REF_NAME is empty; cannot determine release tag." }
$version = $tag -replace '^v',''
if (-not $version) { throw "Computed version is empty after stripping prefix from tag '$tag'." }
Set-Content -Path "src/navigate/VERSION" -Value $version -NoNewline
Write-Host "Version set to $version based on release tag $tag"
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
git tag
python -m build
twine upload -r navigate-micro dist/*