-
Notifications
You must be signed in to change notification settings - Fork 51
100 lines (98 loc) · 3.4 KB
/
build-wheel.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
name: Build package
on:
push:
jobs:
set_version:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get branch name
id: branch_name
run: |
GIT_BRANCH=`git symbolic-ref --short HEAD | sed "s/[^[:alnum:].]//g"`
echo "::set-output name=GIT_BRANCH::${GIT_BRANCH}"
- name: Get semantic version
uses: paulhatch/[email protected]
id: versioning
with:
tag_prefix: "v"
major_pattern: "[MAJOR]"
minor_pattern: "[MINOR]"
format: "${major}.${minor}.${patch}.dev${increment}"
bump_each_commit: false
outputs:
version: ${{ github.ref == 'refs/heads/master' && steps.versioning.outputs.version_tag || steps.versioning.outputs.version}}
build_wheel:
runs-on: ubuntu-20.04
needs: [ set_version ]
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install build dependencies
shell: bash -l {0}
working-directory: ./ton-http-api/
run: |
python -m pip install build wheel
python -m pip install -r requirements.txt
- name: Build distributions
shell: bash -l {0}
working-directory: ./ton-http-api/
run: TON_HTTP_API_VERSION=${{ needs.set_version.outputs.version }} python setup.py sdist bdist_wheel
- name: Check distributions
shell: bash -l {0}
working-directory: ./ton-http-api/
run: |
echo $(pwd)
ls $(pwd)/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ton-http-api-package
path: |
ton-http-api/dist/*.whl
ton-http-api/dist/*.tar.gz
upload-pypi:
runs-on: ubuntu-20.04
needs: [ set_version, build_wheel ]
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: ton-http-api-package
path: dist
- name: Check distributions
shell: bash -l {0}
run: ls -la dist/
- name: Create release tag
if: ${{ github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ needs.set_version.outputs.version }}',
sha: context.sha
})
- name: Publish package to test PyPI
if: ${{ github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/
- name: Publish package to PyPI
if: ${{ github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
repository_url: https://upload.pypi.org/legacy/