-
Notifications
You must be signed in to change notification settings - Fork 181
92 lines (88 loc) · 3.18 KB
/
release-python-flask.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
name: Create Flask Integration Release
on:
push:
tags:
- "flask-v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
version:
name: Compute and verify the version number
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set version env
env:
github_ref: ${{ github.ref }}
run: echo "oso_version=${github_ref/refs\/tags\/flask-v/}" >> $GITHUB_ENV
- name: Check python version matches
run: grep "__version__ = \"$oso_version\"" flask_oso/__init__.py
working-directory: languages/python/flask-oso
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: version
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.7"
- name: Copy in readme
run: |
rm languages/python/flask-oso/README.md
cp README.md languages/python/flask-oso/README.md
- name: Upgrade pip and install wheel
run: |
pip install --upgrade pip
pip install wheel
- name: Build wheels
run: |
python -m pip wheel --no-deps -w wheelhouse .
working-directory: languages/python/flask-oso
- uses: actions/upload-artifact@v2
with:
name: wheel
path: languages/python/flask-oso/wheelhouse/*.whl
# TODO what validation can we do here.
release:
name: Create release
runs-on: ubuntu-latest
needs:
[
build_wheels,
]
steps:
- name: Set version output
id: version
env:
github_ref: ${{ github.ref }}
run: echo "::set-output name=oso_version::${github_ref/refs\/tags\/flask-v/}"
- name: Download oso python wheels from package run
uses: actions/download-artifact@v1
with:
name: wheel
- name: Zip file
run: zip --junk-paths -r flask-oso-python.zip wheel/
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: flask-v${{ steps.version.outputs.oso_version }}
release_name: flask-oso ${{ steps.version.outputs.oso_version }}
body: |
flask-oso ${{ steps.version.outputs.oso_version }}
draft: false
prerelease: true
- name: Upload Python Package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./flask-oso-python.zip
asset_name: flask-oso-python-${{ steps.version.outputs.oso_version }}.zip
asset_content_type: application/zip