Skip to content

Commit

Permalink
Included action.yml for publishing PyPI
Browse files Browse the repository at this point in the history
- Changed name of conda publish action
- Added action for PyPI publish
- Changed workflow to deploy nightly to include PyPI package deployment
- Changed versioning to match allowed formats by PyPI
  • Loading branch information
GuiMacielPereira committed Mar 15, 2024
1 parent 74e918c commit 81c1afc
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ runs:
shell: bash -l {0}
run: |
conda config --set always_yes yes --set changeps1 no
conda create -n build-env python=3.8.*
conda create -n build-env python=3.10.*
conda activate build-env
mamba install -c conda-forge mamba conda-build anaconda-client conda-verify
conda config --add channels mantid
Expand Down
26 changes: 26 additions & 0 deletions .github/actions/publish-pypi-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and upload pypi package

inputs:
token:
description: 'PyPI API Token'
required: true

description: Build and upload pypi package
runs:
using: "composite"

steps:
- name: Make build-env-pypi
shell: bash -l {0}
run: |
conda config --set always_yes yes --set changeps1 no
conda create -n build-env-pypi python=3.10.*
conda activate build-env-pypi
mamba install -c conda-forge python-build twine
- name: Build package
shell: bash -l {0}
run: |
conda activate build-env-pypi
python -m build
twine upload -r testpypi -u __token__ -p ${{ inputs.token }} dist/*
27 changes: 17 additions & 10 deletions .github/workflows/deploy_conda_nightly.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Deploy mvesuvio nightly

on:
workflow_run:
workflows: ["mvesuvio nightly build"]
branches: [main]
types:
- completed
on: push
# workflow_run:
# workflows: ["mvesuvio nightly build"]
# branches: [main]
# types:
# - completed

jobs:
build_conda_and_upload:
Expand All @@ -19,13 +19,14 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
ref: publish-nighly-pypi
# ref: main

- name: Check for changes since last build
run: |
echo "recentCommits=$(test -z $(git log --since="yesterday" -1 --format=%h) && echo false || echo true)" >> $GITHUB_ENV
- name: Setup Miniconda
if: ${{ env.recentCommits == 'true'}}
# if: ${{ env.recentCommits == 'true'}}
uses: conda-incubator/[email protected]
with:
miniforge-version: latest
Expand All @@ -35,8 +36,14 @@ jobs:
auto-activate-base: false

- name: Build mvesuvio nightly conda package
if: ${{ env.recentCommits == 'true'}}
uses: ./.github/actions/publish-package
# if: ${{ env.recentCommits == 'true'}}
uses: ./.github/actions/publish-conda-package
with:
label: nightly
token: ${{ secrets.ANACONDA_API_TOKEN }}

- name: Build mvesuvio nightly PyPI package
# if: ${{ env.recentCommits == 'true'}}
uses: ./.github/actions/publish-pypi-package
with:
token: ${{ secrets.PYPI_TOKEN }}
4 changes: 2 additions & 2 deletions conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
python:
- 3.8
- 3.10

jacobi:
- 0.4.2 #pinned until later versions are proven.

mantid:
- '>=6.7' #pinned until upgrade to python 3.10.
- '>=6.7' #pinned until upgrade to python 3.10.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ method = "minor"

[tool.versioningit.format]
distance = "{version}.dev{distance}"
dirty = "{version}+uncommitted"
distance-dirty = "{version}.dev{distance}+uncommitted"
dirty = "{version}.dev{distance}"
distance-dirty = "{version}.dev{distance}"

[tool.versioningit.write]
file = "mvesuvio/_version.py"

0 comments on commit 81c1afc

Please sign in to comment.