-
Notifications
You must be signed in to change notification settings - Fork 17
79 lines (73 loc) · 2.85 KB
/
pypi-tag-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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: PyPi publication
on:
push:
tags:
- '[0-9].[0-9].*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 sdap_ingest_manager --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
#flake8 sdap_ingest_manager --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Deploy locally
run: |
pip install .
- name: Update default configuration
run: |
import sys
import os
import pystache
renderer = pystache.Renderer()
credentials_template_path = os.path.join(sys.prefix, ".sdap_ingest_manager/credentials.json.template")
credentials_content = renderer.render_path(credentials_template_path, {'client_id': '${{secrets.google_api_client_id}}', 'client_secret': '${{secrets.google_api_client_secret}}'})
credentials_target_path = os.path.join(sys.prefix, ".sdap_ingest_manager/credentials.json")
with open(credentials_target_path, "w") as f:
f.write(credentials_content)
shell: python
- name: Test with pytest
run: |
pip install pytest
pytest -s
- name: Create the package
run: |
pip install setuptools wheel
rm -f dist/*
python setup.py sdist bdist_wheel
- name: Publish the Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.pypi_username }}
password: ${{ secrets.pypi_password }}