CI.yml: Now runs the conda build process as part of CI #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
on: [push, pull_request] | |
jobs: | |
conda: | |
name: build and deploy to conda | |
if: github.repository == 'payu-org/payu' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
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 | |
uses: uibcdf/[email protected] | |
with: | |
meta_yaml_dir: conda | |
python-version: 3.11 | |
user: accessnri | |
label: main | |
token: ${{ secrets.anaconda_token }} | |
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/ |