Merge pull request #98 from umr-lops/fix-ci-build-version #21
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: Build and Upload Conda Package | |
on: | |
release: | |
types: | |
- created | |
push: | |
# Triggers on push to any branch | |
jobs: | |
build-and-upload-conda-package: | |
if: contains(github.event.head_commit.message, '[force-build]') || startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
#${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: 3.9 | |
- name: Install conda-build | |
run: | | |
conda init | |
source ~/.bashrc | |
conda activate base | |
conda install -y -c conda-forge conda-build anaconda-client | |
- name: Set version without 'v' | |
run: | | |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF_NAME#v} | |
else | |
VERSION="0.0.0" # Dummy version for testing | |
fi | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
echo "GIT_DESCRIBE_TAG=${VERSION}" >> $GITHUB_ENV | |
- name: Build and Upload Conda package | |
env: | |
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
run: | | |
cd recipe | |
conda init | |
source ~/.bashrc | |
conda activate base | |
conda-build . --token $ANACONDA_TOKEN --user tcevaer -c tcevaer -c conda-forge |