-
Notifications
You must be signed in to change notification settings - Fork 9
129 lines (113 loc) · 3.5 KB
/
pypi.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
name: Test and Upload Pypi
on:
push:
branches:
- main
permissions:
contents: write
packages: write
jobs:
build:
runs-on: self-hosted
env:
ODOO_TEST: "16.0"
ODOO_PYTHON_VERSION: "3.11.10"
ODOOCMD: "/home/githubrunner/.local/bin/odoo"
LAST_STABLE_VERSION: "0.5.91"
PROXY_PORT: 3333
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: setup merge
run: |
set -x
git config --global user.email '[email protected]'
git config --global user.name '[email protected]'
git fetch
- name: install pipx
run: |
sudo apt update && sudo apt install -y python3-dev \
python3-pip python3-venv python3-virtualenv
pip install pip -U
pip install pipx
- name: setup gimera
run: |
set -ex
pipx install gimera
pipx upgrade gimera
- name: install woodo
run: |
pipx install -e --force .
echo "##################"
echo $PATH
echo "##################"
#WHY?
pipx runpip wodoo install requests==2.31.0 || true
- name: do some testing
run: |
set -x
TEMPODOODIR="./$(basename $(mktemp))/odoo"
mkdir -p "$TEMPODOODIR"
cd "$TEMPODOODIR"
$ODOOCMD init . "$ODOO_TEST"
docker ps
$ODOOCMD setting ODOO_PYTHON_VERSION=$ODOO_PYTHON_VERSION -R
$ODOOCMD setting RUN_ODOO_CRONJOBS=0 -R
$ODOOCMD setting RUN_CRONJOBS=0 -R
$ODOOCMD setting DEVMODE=1 -R
$ODOOCMD setting WODOO_VERSION=${LAST_STABLE_VERSION}
$ODOOCMD setting PROXY_PORT=${PROXY_PORT}
$ODOOCMD build
$ODOOCMD kill || true
$ODOOCMD -f db reset
$ODOOCMD update crm
$ODOOCMD kill || true
$ODOOCMD -f down || true
- name: increment version
run: |
python3 << EOF
import re
from pathlib import Path
file = Path('setup.cfg')
lines = file.read_text()
find = re.findall(r'version = (.*)', lines)
old_version_string = find[-1]
old_version = f'version = {old_version_string}'
version = list(map(int, find[-1].split('.')))
version[-1] += 1
version_string = '.'.join(map(str, version))
new_version = 'version = ' + version_string
lines = lines.replace(old_version, new_version)
file.write_text(lines)
Path("wodoo/version.txt").write_text(version_string)
EOF
- name: commit and tag new version
run: |
set -x
git fetch --tags
COMMIT_MSG='autocommit by github action'
if [ $(git log -n1 | grep -q "$COMMIT_MSG") ]; then
echo "No new commit"
echo "DO_PYPI=0" >> "$GITHUB_ENV"
else
git add .
git commit -am "$COMMIT_MSG"
VERSION=$(cat wodoo/version.txt)
git tag ${VERSION}
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git push origin --tags
git push
python3 setup.py sdist
echo "DO_PYPI=1" >> "$GITHUB_ENV"
fi
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
if: env.DO_PYPI == '1'