-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (89 loc) · 3.37 KB
/
ci.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
name: CI
on:
push:
pull_request:
release:
types: [published]
jobs:
style-python:
name: "💄 Style: python"
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
with:
python-version: "3.10"
- name: Install style check dependencies
run: |
pip install flake8==6.0.0
pip install pep8-naming==0.13.2
- name: Check style
run: |
flake8 .
style-js:
name: "💄 Style: js"
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup node
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # [email protected]
with:
node-version: "18"
- name: Install dependencies
run: cd inventree_template_editor/frontend && npm ci
- name: Check style
run: cd inventree_template_editor/frontend && npm run lint
build-js:
name: "🏗️ Build: js"
needs: [style-js]
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup node
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # [email protected]
with:
node-version: "18"
- name: Install dependencies
run: cd inventree_template_editor/frontend && npm ci
- name: Build js
run: cd inventree_template_editor/frontend && npm run build
- name: Upload frontend artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected]
with:
name: frontend
path: inventree_template_editor/static/dist
publish:
if: github.event_name == 'release' && github.event.action == 'published'
needs: [build-js]
name: 📦 Publish to PyPi
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/inventree-template-editor-plugin
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
with:
python-version: "3.10"
- name: Install build dependencies
run: pip install --upgrade wheel setuptools twine build
- name: Download frontend artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # [email protected]
with:
name: frontend
path: inventree_template_editor/static/dist
- name: Build pip package
run: python3 -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8 # [email protected]