-
Notifications
You must be signed in to change notification settings - Fork 14
145 lines (125 loc) · 3.43 KB
/
build-and-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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Build and release
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
EXTRAS: all,postgresql
SQLALCHEMY_DATABASE_URI: "postgresql+psycopg2://postgres:postgres@localhost:5432/invenio"
permissions:
id-token: write
contents: write
actions: write
checks: write
deployments: write
discussions: write
issues: write
pages: read
packages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
jobs:
test:
services:
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DATABASE: invenio
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- python: python2
pip: pip2.7
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install pip2
run: |
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
sudo python2.7 get-pip.py
- name: Install python dependencies
run: |
${{ matrix.pip }} install --user --upgrade pip
${{ matrix.pip }} --no-cache-dir install --user setuptools wheel
${{ matrix.pip }} --no-cache-dir install --user -r requirements.txt
${{ matrix.pip }} --no-cache-dir install --user -e .[${EXTRAS}]
- name: Show python dependencies
run: |
${{ matrix.python }} --version
${{ matrix.pip }} freeze
- name: Run tests
run: |
./run-tests.sh
push-to-master-check:
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
- run: echo "Deploying branch $GITHUB_REF"
bump:
needs:
- test
- push-to-master-check
runs-on: ubuntu-20.04
steps:
- name: Check out the repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install bump2version
shell: bash
run: |
python -m pip install --upgrade pip
pip install bump2version
- name: Configure git
shell: bash
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Bump version
shell: bash
run: |
bump2version patch --tag --verbose
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
publish:
needs: bump
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
python-version: 2.7.17
fetch-depth: 0
- name: Install python dependencies
run: |
pip install --user --upgrade pip
pip --no-cache-dir install --user setuptools wheel
pip --no-cache-dir install --user -r requirements.txt
pip --no-cache-dir install --user -e .[${EXTRAS}]
- name: Show python dependencies
run: |
pip freeze
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}