forked from conda/conda
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (78 loc) · 2.94 KB
/
build-upload-pkgs.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
name: Build and upload conda packages
on:
workflow_run:
workflows:
- CI tests
branches:
- master
types:
- completed
jobs:
# Check for required configuration/secrets needed to build & upload. Done
# this way because secrets cannot be used directly in GitHub Action
# conditionals; see https://github.com/actions/runner/issues/520 for details.
check-config:
runs-on: ubuntu-latest
outputs:
okay: ${{ steps.check-secrets.outputs.defined }}
steps:
- name: Check for secrets needed to build & upload packages
id: check-secrets
env:
ANACONDA_ORG_CHANNEL: ${{ secrets.ANACONDA_ORG_CHANNEL }}
ANACONDA_ORG_LABEL: ${{ secrets.ANACONDA_ORG_LABEL }}
ANACONDA_ORG_TOKEN: ${{ secrets.ANACONDA_ORG_TOKEN }}
shell: bash -l {0}
run: |
test -n "${ANACONDA_ORG_CHANNEL}" || \
{ echo "FATAL: ANACONDA_ORG_CHANNEL secret not configured" >&2; exit 1; }
test -n "${ANACONDA_ORG_LABEL}" || \
{ echo "FATAL: ANACONDA_ORG_LABEL secret not configured" >&2; exit 1; }
test -n "${ANACONDA_ORG_TOKEN}" || \
{ echo "FATAL: ANACONDA_ORG_TOKEN secret not configured" >&2; exit 1; }
echo "::set-output name=defined::true"
build-conda-pkgs:
needs:
- check-config
if: |
github.event.workflow_run.conclusion == 'success' &&
needs.check-config.outputs.okay == 'true'
strategy:
matrix:
include:
- runner: ubuntu-latest
subdir: linux-64
- runner: macos-latest
subdir: osx-64
- runner: windows-latest
subdir: win-64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v2
- name: Build & upload package
shell: bash -l {0}
# Note: In the `run` commands below, `ANACONDA_ORG_CHANNEL` and
# `ANACONDA_ORG_LABEL` don't really _need_ to be secrets (e.g., masked
# out in the logs), but I don't really know of another way of
# performing per-repository/fork configuration for GitHub Actions.
run: |
set -euo pipefail
conda activate
conda update --yes --quiet conda
conda install --yes --quiet conda-build anaconda-client git
conda info
conda config --show-sources
conda list
conda build --croot=./pkgs conda.recipe
anaconda --token ${{ secrets.ANACONDA_ORG_TOKEN }} upload \
--force --register --no-progress \
--user ${{ secrets.ANACONDA_ORG_CHANNEL }} \
--label ${{ secrets.ANACONDA_ORG_LABEL }} \
./pkgs/${{ matrix.subdir }}/conda-*.tar.bz2
echo "Uploaded the following files:"
ls ./pkgs/${{ matrix.subdir }}/conda-*.tar.bz2 | cut -d/ -f3- | tr ' ' $'\n'