-
Notifications
You must be signed in to change notification settings - Fork 2
121 lines (99 loc) · 3.47 KB
/
Copy pathrelease.yml
File metadata and controls
121 lines (99 loc) · 3.47 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
name: Package Releases
on:
push:
branches: [master]
tags: ["*"]
pull_request:
branches: [master]
jobs:
release:
name: Create Release
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Extract Flags
id: flags
run: |
echo ::set-output name=tag::${GITHUB_REF##*/}
- name: Remove Unused Code
run: |
# Remove hundreds of MBs of unused third_party code.
find ./alephzero/third_party \
-type f \
! -wholename './alephzero/third_party/yyjson/src/*' \
! -wholename './alephzero/third_party/json/single_include/nlohmann/*' \
-delete
while [[ $(find ./alephzero/third_party -empty -type d) ]]; do
find ./alephzero/third_party -empty -type d -delete
done
# We've removed doctest and picobench, so no point keeping C++ unit tests.
rm -rf ./alephzero/src/bench ./alephzero/src/test
# Drop git history.
rm -rf ./.git alephzero/.git
- name: Archive Source
run: |
mkdir archives
tar --exclude=./archives -czvf ./archives/alephzero.tar.gz .
zip -x ./archives -r ./archives/alephzero.zip .
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./archives/alephzero.tar.gz
asset_name: alephzero-${{ steps.flags.outputs.tag }}.tar.gz
asset_content_type: application/gzip
- name: Upload zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./archives/alephzero.zip
asset_name: alephzero-${{ steps.flags.outputs.tag }}.zip
asset_content_type: application/zip
pip:
name: Send to PyPI
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
container:
image: "quay.io/pypa/manylinux_2_24_x86_64"
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: install apt deps
run: apt update && apt install -y python3-pip
- name: install pip deps
run: python3 -m pip install -U build pybind11 setuptools twine virtualenv wheel
- name: build package
run: python3 -m build
- name: auditwheel
run: |
for whl in dist/*-linux_x86_64.whl; do
auditwheel repair "$whl" -w dist/
done
rm dist/*-linux_x86_64.whl
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}