-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (101 loc) · 3.47 KB
/
release.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
101
102
103
104
105
106
name: "release"
on:
push:
tags:
- "v*"
jobs:
test:
uses: ./.github/workflows/test.yml
publish-conda-pkg-to-anaconda-dot-org:
name: Publish conda package to Anaconda.org
runs-on: ubuntu-latest
if: github.event_name == 'push' # Only run on push to main branch
needs: [test]
steps:
- name: Retrieve the source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Create build environment
run: |
source $CONDA/bin/activate
conda create -n build --file ./etc/build.linux-64.lock
- name: Download the build artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: anaconda-cli-base-conda-${{ github.sha }}
path: ~/anaconda-cli-base-conda-bld
- name: publish
env:
TOKEN: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}
run: |
source $CONDA/bin/activate && conda activate build
[[ "$GITHUB_REF" =~ ^refs/tags/v ]] || export LABEL="--label dev"
anaconda --verbose \
--token $TOKEN \
upload \
--user anaconda-cloud \
$LABEL \
--force \
~/anaconda-cli-base-conda-bld/noarch/anaconda-cli-base-*
publish-wheel-to-anaconda-dot-org:
name: Publish wheel to Anaconda.org
runs-on: ubuntu-latest
if: github.event_name == 'push' # Only run on push to main branch
needs: [test]
steps:
- name: Retrieve the source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Download the build artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: anaconda-cli-base-wheel-${{ github.sha }}
path: ~/dist
- name: Create build environment
run: |
source $CONDA/bin/activate
conda create -n build --file ./etc/build.linux-64.lock
- name: Upload to anaconda.org
env:
TOKEN: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}
GITHUB_REF: ${{ github.ref }}
run: |
source $CONDA/bin/activate && conda activate build
[[ "$GITHUB_REF" =~ ^refs/tags/v ]] || export LABEL="--label dev"
anaconda --verbose \
--token $TOKEN \
upload \
--user anaconda-cloud \
~/dist/*.whl \
--summary \
"A base CLI entrypoint supporting Anaconda CLI plugins" \
$LABEL \
--force \
publish-to-pypi:
name: Build & publish to PyPI
if: startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
- name: Download the build artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: anaconda-cli-base-wheel-${{ github.sha }}
path: ~/dist
- name: Create build environment
run: |
source $CONDA/bin/activate
conda create -n build --file ./etc/build.linux-64.lock
- name: Upload to PyPI with twine
run: |
source $CONDA/bin/activate && conda activate build
twine upload ~/dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}