forked from payu-org/payu
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 2.17 KB
/
CD.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
name: CD
on: [push, pull_request]
jobs:
pypi-build:
name: Build package for PyPI
if: github.repository == 'payu-org/payu' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
- run: |
python3 -m pip install --upgrade build && python3 -m build
- uses: actions/upload-artifact@v3
with:
path: ./dist
pypi-publish:
# Split build and publish to restrict trusted publishing to just this workflow
needs: ['pypi-build']
name: Publish to PyPI.org
if: github.repository == 'payu-org/payu' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
path: artifact/
- name: Publish package distributions to PyPI
# This is version v1.8.10
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
with:
packages_dir: artifact/
conda:
name: build and deploy to conda
needs: pypi-publish
if: always() && needs.pypi-publish.result == 'success'
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
python-version: 3.11
environment-file: conda/environment.yml
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: Build and upload the conda package
env:
PYPI_URL: https://pypi.io
uses: uibcdf/[email protected]
with:
meta_yaml_dir: conda
python-version: 3.11
user: accessnri
label: main
token: ${{ secrets.anaconda_token }}