-
Notifications
You must be signed in to change notification settings - Fork 17
135 lines (119 loc) · 4.16 KB
/
deploy.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
name: Build and upload
# Build on every branch push, tag push, and pull request change:
# on: [push, pull_request]
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- run: npm ci # install from package-lock.json (without modifying it)
- run: npm run build
- run: git status
- name: Build sdist
run: python setup.py sdist
- name: Install Python part to build static gh-pages page
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -e "."
- name: Print environment
run: |
python -m pip freeze
python --version
python -c "import openpifpaf; print(openpifpaf.__version__)"
python -c "import openpifpafwebdemo; print(openpifpafwebdemo.__version__)"
- name: Build gh-pages
run: python -m openpifpafwebdemo.server --write-static-page=gh-pages --google-analytics=UA-137290484-1 --resolution=0.2
- uses: actions/upload-artifact@v3
with:
path: |
dist/*.tar.gz
gh-pages
create_docker:
needs: [build_sdist]
name: Build and publish docker image
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Check out the repo
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: artifact
path: .
- run: cp dist/openpifpafwebdemo-*.tar.gz dist/openpifpafwebdemo-latest.tar.gz
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: svenkreiss/openpifpafwebdemo
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
upload_pypi:
needs: [build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: .
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# To test: repository_url: https://test.pypi.org/legacy/
upload_ghpages:
needs: [build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: .
- name: Get ONNX models
run: |
wget -q https://github.com/openpifpaf/openpifpafwebdemo/releases/download/v0.12.6/openpifpaf-resnet18.onnx
wget -q https://github.com/openpifpaf/openpifpafwebdemo/releases/download/v0.12.6/openpifpaf-resnet50.onnx
mv *.onnx gh-pages/static/
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages/
force_orphan: true