generated from ACCESS-NRI/template
-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (77 loc) · 2.66 KB
/
cd.yml
File metadata and controls
88 lines (77 loc) · 2.66 KB
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
name: CD
on:
push:
tags:
- 'v*'
env:
PY_VERSION: 3.12
jobs:
pypi-build:
name: Build package for PyPI
if: github.repository == 'ACCESS-NRI/access-experiment-runner' # exclude forks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PY_VERSION }}
- run: |
python3 -m pip install --upgrade build && python3 -m build
- uses: actions/upload-artifact@v4
with:
name: release
path: dist
pypi-publish:
# Split build and publish to restrict trusted publishing to just this workflow
needs: ['pypi-build']
name: Publish to PyPI.org
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: release
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
conda:
name: Build with conda and upload
if: github.repository == 'ACCESS-NRI/access-experiment-runner' # exclude forks
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup conda environment
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
with:
miniconda-version: "latest"
python-version: ${{ env.PY_VERSION }}
environment-file: conda/environment.yml
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: Build and upload conda package
uses: ACCESS-NRI/action-build-and-upload-conda-packages@v3.0.0
with:
meta_yaml_dir: conda
user: ${{ vars.ANACONDA_USER }}
label: main
token: ${{ secrets.ANACONDA_TOKEN }}
deploy-payu-dev:
name: Deploy payu-dev environment
needs: [pypi-publish, conda]
if: github.repository == 'ACCESS-NRI/access-experiment-runner' && startsWith(github.ref, 'refs/tags/v') # exclude forks
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.MODEL_RELEASE_CONDAENV_WORKFLOW_DISPATCH_TOKEN }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Dispatch deploy workflow in model-release-condaenv
run: |
# Dispatch the deploy_payu_dev.yml workflow from the ACCESS-NRI/model-release-condaenv repo
gh workflow run deploy_payu_dev.yml \
--repo ACCESS-NRI/model-release-condaenv \
--ref main