-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (124 loc) · 4.1 KB
/
release.yml
File metadata and controls
155 lines (124 loc) · 4.1 KB
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
146
147
148
149
150
151
152
153
154
155
name: release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
this-tag: ${{ steps.this-tag.outputs.tag }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Get tag name
id: this-tag
run: |
TAG=${GITHUB_REF#refs/*/}
echo "$TAG"
echo "::set-output name=tag::$TAG"
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Should match __version__ in shapeflow/__init__.py
run: |
cat shapeflow/__init__.py | grep "__version__ = "
cat shapeflow/__init__.py | grep "__version__ = \"$TAG\""
- name: Should match version in shapeflow/setup/ploy
run: |
cat shapeflow/setup/ploy | grep "version: "
cat shapeflow/setup/ploy | grep "version: $TAG"
- name: Should match version in ui/package.json
run: |
cat ui/package.json | grep "\"version\": "
cat ui/package.json | grep "\"version\": \"$TAG\""
- name: Should have a changelog entry
run: |
cat docs/source/changelog.rst | grep -P "^$TAG$"
artifacts:
runs-on: ubuntu-latest
needs: [check-version]
outputs:
tag: ${{ steps.gitploy.outputs.tag }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install npm dependencies
working-directory: ui
run: npm install
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install gitploy
run: |
git clone https://github.com/ybnd/gitploy ~/gitploy
cd ~/gitploy
python setup.py install
- name: Generate deployment script
id: gitploy
run: |
cp shapeflow/setup/ploy .ploy
echo "::set-output name=tag::$( cat .ploy | sed -n -e 's/^.*version: //p')"
python -m gitploy .
- name: Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.check-version.outputs.this-tag }}
file: deploy_shapeflow-${{ steps.gitploy.outputs.tag }}.py
prerelease: true
- name: Compile ui
working-directory: ui
run: npm run build
- name: Tarball ui
run: |
cd ui && tar -czvf "../dist-${{ steps.gitploy.outputs.tag }}.tar.gz" dist
- name: Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.check-version.outputs.this-tag }}
file: dist-${{ steps.gitploy.outputs.tag }}.tar.gz
prerelease: true
test-deploy:
needs: [artifacts]
if: ${{ needs.artifacts.outputs.tag }}
env:
TAG: ${{ needs.artifacts.outputs.tag }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: 3.7
- os: ubuntu-latest
python-version: 3.8
- os: windows-latest
python-version: 3.8
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Download deployment script
run: curl -LO "https://github.com/ybnd/shapeflow/releases/download/${{ env.TAG }}/deploy_shapeflow-${{ env.TAG }}.py"
- name: Run deployment script
run: python "deploy_shapeflow-${{ env.TAG }}.py" -y
- name: Should be able to run sf.py
run: |
python sf.py --version
- name: Should have a ui/dist/ directory
run: |
tree ui/dist/