-
-
Notifications
You must be signed in to change notification settings - Fork 14
76 lines (71 loc) · 2.33 KB
/
python-publish.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
name: Upload Python Package
on: workflow_dispatch
permissions: write-all
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
VERSION_NUMBER: ${{ steps.set-env-var-version.outputs.VERSION_NUMBER }}
SHA256: ${{ steps.set-env-var-sha256.outputs.SHA256 }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set env var
id: set-env-var-version
run: |
echo VERSION_NUMBER=$(python -c 'import bigtree; print(bigtree.__version__)') >> $GITHUB_OUTPUT
- name: Create release
uses: ncipollo/release-action@v1
env:
VERSION_NUMBER: ${{ steps.set-env-var-version.outputs.VERSION_NUMBER }}
with:
name: v${{ env.VERSION_NUMBER }}
tag: ${{ env.VERSION_NUMBER }}
generateReleaseNotes: true
makeLatest: true
- name: Set env var 2
id: set-env-var-sha256
env:
VERSION_NUMBER: ${{ steps.set-env-var-version.outputs.VERSION_NUMBER }}
run: |
echo SHA256=$(curl -sL https://github.com/kayjan/bigtree/archive/${VERSION_NUMBER}.tar.gz | openssl sha256 | sed 's/.*(stdin)= //') >> $GITHUB_OUTPUT
publish-to-pypi:
runs-on: ubuntu-latest
needs: create-release
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Build package
run: hatch build
- name: Publish package
env:
HATCH_USER: ${{ secrets.HATCH_USER }}
HATCH_AUTH: ${{ secrets.HATCH_AUTH }}
run: hatch publish -u $HATCH_USER -a $HATCH_AUTH
publish-to-conda:
runs-on: ubuntu-latest
needs: create-release
steps:
- uses: actions/checkout@v3
- name: Set up Conda
run: |
conda install -c conda-forge conda-build conda-verify anaconda-client
- name: Publish to conda
env:
ANACONDA_API_TOKEN: ${{ secrets.CONDA_TOKEN }}
VERSION_NUMBER: ${{ needs.create-release.outputs.VERSION_NUMBER }}
SHA256: ${{ needs.create-release.outputs.SHA256 }}
run: |
cd conda
conda config --set anaconda_upload yes
conda build -c conda-forge --output-folder . .