-
Notifications
You must be signed in to change notification settings - Fork 4
61 lines (59 loc) · 2.03 KB
/
pre_release.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
58
59
60
61
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Pre-Release
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Python
uses: actions/[email protected]
with:
python-version: '3.8'
- name: Permacache Poetry
id: cache-poetry
uses: actions/[email protected]
with:
path: ~/.poetry
key: poetry
- name: Install latest version of Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
- name: Add Poetry to $PATH
run: |
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Add version to environment vars
run: |
PROJECT_VERSION=$(poetry version --short)
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
- name: Cache dependencies
id: cache-deps
uses: actions/[email protected]
with:
path: ${{github.workspace}}/.venv
key: poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: poetry-
- name: Install deps
if: steps.cache-deps.cache-hit != 'true'
run: |
poetry config virtualenvs.in-project true
poetry install --no-interaction
- name: Run tests
run: poetry run test
- name: Build
run: poetry build
- name: Publish in PyPi Test
env:
POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/
POETRY_HTTP_BASIC_TESTPYPI_USERNAME: ${{ secrets.OSC_PYPI_TEST_USER }}
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{ secrets.OSC_PYPI_TEST_TOKEN }}
run: |
poetry config repositories.testpypi "$POETRY_REPOSITORIES_TESTPYPI_URL"
poetry config http-basic.testpypi "$POETRY_HTTP_BASIC_TESTPYPI_USERNAME" "$POETRY_HTTP_BASIC_TESTPYPI_PASSWORD"
poetry publish -r testpypi