158 fix documentation container #133
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: Publish Conda package | |
on: | |
release: | |
types: | |
- published | |
pull_request: | |
jobs: | |
publish: | |
name: Build and publish conda packages | |
runs-on: ubuntu-latest | |
# need for activated env | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: get release info | |
id: release_info | |
run: | | |
if [ "${{ github.event.release.tag_name }}" != "" ]; then | |
version=$(echo ${{ github.event.release.tag_name }} | sed 's/^v//') | |
else | |
version="$(awk -F= '/^PACKAGE_VERSION/ { print $2}' pyincore_viz/globals.py | sed 's/[ "]//g').${{ github.run_number }}" | |
fi | |
echo "VERSION=${version}" >> $GITHUB_ENV | |
echo "VERSION=${version}" | |
./version.sh ${version} | |
testing=$(echo $version | sed 's/[0-9\.]//g') | |
if [ "$testing" == "" ]; then | |
echo "LABEL=main" >> $GITHUB_ENV | |
else | |
echo "LABEL=rc" >> $GITHUB_ENV | |
fi | |
- name: Cache conda | |
uses: actions/cache@v2 | |
env: | |
# Increase this value to reset cache if environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} | |
- name: Install micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
create-args: >- | |
python=3.9 | |
conda | |
environment-file: environment.yml | |
generate-run-shell: true | |
condarc: | | |
channels: | |
- IN-CORE | |
- conda-forge | |
- defaults | |
- name: Build conda package | |
run: | | |
conda install conda-build | |
mkdir dist | |
conda build --output-folder dist \ | |
--label ${{ env.LABEL }} \ | |
recipes | |
shell: micromamba-shell {0} | |
- name: Upload conda package | |
if: github.event_name == 'release' | |
run: | | |
conda install -y anaconda-client | |
anaconda --token ${{ secrets.CONDA_INCORE_TOKEN }} upload \ | |
--user IN-CORE \ | |
--label ${{ env.LABEL }} \ | |
dist/*/pyincore-viz-${{ env.VERSION }}-*.tar.bz2 | |
shell: micromamba-shell {0} | |
- name: Upload binaries to release | |
if: github.event_name == 'release' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: dist/*/pyincore-viz-${{ env.VERSION }}-*.tar.bz2 | |
file_glob: true | |
overwrite: true |