-
Notifications
You must be signed in to change notification settings - Fork 2
91 lines (74 loc) · 2.21 KB
/
Copy pathbuild.yml
File metadata and controls
91 lines (74 loc) · 2.21 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
name: Build
on:
pull_request:
pull_request_target:
types:
- closed
release:
types:
- published
defaults:
run:
shell: bash -l -eo pipefail {0}
jobs:
build:
name: Build ${{ matrix.os }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ 'ubuntu-latest', 'macos-12', 'windows-latest']
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Check out mdal-python
uses: actions/checkout@v3
- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: .github/environment.yml
create-args: |
python=${{ matrix.python-version }}
- name: Install mdal python
run: |
pip install . -vv
- name: Build wheel distribution
if: matrix.os != 'ubuntu-latest'
run: python setup.py --skip-cmake bdist_wheel
- name: Build source distribution
if: matrix.os == 'ubuntu-latest'
run: python setup.py sdist
- name: Upload distribution(s)
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-py${{ matrix.python-version }}
path: ./dist/*
publish:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download distributions
uses: actions/download-artifact@v3
with:
path: ./artifacts
- name: Move artifacts to dist
run: |
mkdir dist
find ./artifacts -type f -exec mv {} ./dist \;
tree ./dist
- name: Publish package - release
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release' && github.event.action == 'published'
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: ./dist
verbose: true
- name: Publish package - test
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'pull_request_target' && github.event.action == 'closed' && github.event.pull_request.merged == true
with:
user: __token__
password: ${{ secrets.PYPI_TEST_TOKEN }}
repository_url: https://test.pypi.org/legacy/
packages_dir: ./dist
verbose: true