-
Notifications
You must be signed in to change notification settings - Fork 6
85 lines (82 loc) · 2.5 KB
/
publish-conda-from-pypi.yaml
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
name: Publish Conda package from PyPI
on:
pull_request:
workflow_dispatch:
inputs:
dry-run:
description: 'Dry run'
required: false
default: false
type: boolean
platforms:
description: 'Target platforms'
required: false
default: 'noarch'
override:
description: 'Override'
required: false
default: true
python-version:
description: 'Python version'
required: false
default: '3.7'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- shell: bash
env:
PLATFORMS: ${{ inputs.platforms }}
DRYRUN: ${{ inputs.dry-run }}
OVERRIDE: ${{ inputs.override }}
run: echo "$PLATFORMS // $DRYRUN // $OVERRIDE"
- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
mamba-version: "*"
channels: conda-forge
channel-priority: true
activate-environment: build
- name: Install boa / anaconda
shell: bash -el {0}
run: |
mamba install boa anaconda-client
- name: Build
shell: bash -el {0}
env:
PY: ${{ inputs.python-version }}
run: |
PY=($PY)
OPT=""
for V in "${PY[@]}"; do
OPT+=",${V}"
done
OPT="{python: [${OPT:1}]}"
conda mambabuild --variants "$OPT" -c pytorch --croot . .conda
- name: Convert
shell: bash -el {0}
env:
PLATFORMS: ${{ inputs.platforms }}
run: |
for PLATFORM in osx-64 osx-arm64 linux-32 linux-64 linux-ppc64 linux-s390x linux-armv6l linux-armv7l linux-aarch64 win-32 win-64
do
if [[ $PLATFORMS == *"all"* || $PLATFORMS == *"${PLATFORM}"* ]]; then
conda convert -p $PLATFORM linux-64/*.tar.bz2
fi
done
- name: "Publish (dry run: ${{ inputs.dry-run }})"
if: inputs.dry-run == 'false'
shell: bash -el {0}
env:
OVERRIDE: ${{ inputs.override }}
PLATFORMS: ${{ inputs.platforms }}
ANACONDA_API_TOKEN: ${{ inputs.password }}
run: |
export ANACONDA_API_TOKEN
[[ "${OVERRIDE}" == "true" ]] && FORCE="--force" || FORCE=""
for PLATFORM in noarch osx-64 osx-arm64 linux-32 linux-64 linux-ppc64 linux-s390x linux-armv6l linux-armv7l linux-aarch64 win-32 win-64
do
if [[ $PLATFORMS == *"all"* || $PLATFORMS == *"${PLATFORM}"* ]]; then
anaconda upload ${FORCE} --label main ${PLATFORM}/*.tar.bz2
fi
done