-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (57 loc) · 2.19 KB
/
elements.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
name: Check elements
on:
schedule:
- cron: "30 0 * * *"
jobs:
deploy:
runs-on: ubuntu-latest
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Update flask-openapi3-elements
id: update_elements
run: |
cd ./flask-openapi3-elements/flask_openapi3_elements
old_version=$(cat __version__.py | grep -oP '(?<=__version__ = ").*(?=")')
new_version=$(npm show @stoplight/elements version)
if [ "${new_version}" != "${old_version}" ]; then
curl -L https://cdn.jsdelivr.net/npm/@stoplight/elements@${new_version}/web-components.min.js \
-o ./templates/elements/js/web-components.min.js
curl -L https://cdn.jsdelivr.net/npm/@stoplight/elements@${new_version}/styles.min.css \
-o ./templates/elements/css/styles.min.css
echo -e "# -*- coding: utf-8 -*-\n\n__version__ = \"${new_version}\"" > __version__.py
echo "new_version=${new_version}" >> $GITHUB_OUTPUT
echo "is_update=true" >> $GITHUB_OUTPUT
else
echo "is_update=false" >> $GITHUB_OUTPUT
fi
- name: Git Commit
if: ${{ steps.update_elements.outputs.is_update == 'true' }}
id: git_commit
run: |
new_version=${{ steps.update_elements.outputs.new_version }}
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update elements ${new_version}"
git push origin master
- name: Release flask-openapi3-elements
if: ${{ steps.git_commit.outcome == 'success' }}
run: |
cd flask-openapi3-elements
python -m build
twine upload dist/*