Skip to content

Update setup.py

Update setup.py #36

Workflow file for this run

name: build_and_publish
on:
push:
branches:
- stable
- main
jobs:
get_version:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout code
id: git_checkout
uses: actions/checkout@v3
- name: Get version
id: get_version
run: |
CURRENT_VERSION=$(sed -n '/^current_version/{ s/^.\+ = //; p; }' .bumpversion.cfg)
if [[ "${GITHUB_REF}" == 'refs/heads/stable' ]]; then
echo "::set-output name=version::${CURRENT_VERSION}"
elif [[ "${GITHUB_REF}" == 'refs/heads/main' ]]; then
DEV_VERSION="${CURRENT_VERSION}"+dev$(echo "${GITHUB_SHA}" | cut -c-7)
echo "::set-output name=version::${DEV_VERSION}"
echo "::set-output name=bump_version::yes"
else
echo "got bad gh ref: ${GITHUB_REF}" 1>&2
exit 1
fi
outputs:
bump_version: ${{ steps.get_version.outputs.bump_version }}
version: ${{ steps.get_version.outputs.version }}
build_and_publish_on_conda:
runs-on: ubuntu-latest
needs: get_version
defaults:
run:
shell: bash -l {0}
env:
VERSION: ${{ needs.get_version.outputs.version }}
steps:
- name: Checkout code
id: git_checkout
uses: actions/checkout@v3
- name: Setup conda
id: setup_conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
miniforge-variant: Mambaforge-pypy3
channels: umccr,bioconda,conda-forge,defaults
channel-priority: true
- name: Prepare env
id: prepare_env
run: |
mamba install boa anaconda-client bump2version
# When on development branch (inferred from bump_version value), append '-dev' to package name and set
# commit-specific version
- name: Set package name and version
if: ${{ needs.get_version.outputs.bump_version == 'yes' }}
run: |
sed -i 's/name: bactabolize/name: bactabolize-dev/' conda/bactabolize/meta.yaml;
bump2version patch \
--new-version "${VERSION}" \
--allow-dirty \
--no-commit
- name: Build and upload conda package
run: |
conda mambabuild \
--token "${{ secrets.ANACONDA_TOKEN }}" \
conda/bactabolize/
# build_and_publish_on_dockerhub:
# runs-on: ubuntu-latest
# needs:
# - get_version
# - build_and_publish_on_conda
# # Only push on push to stable, which implicitly should be only version bumps
# if: github.ref == 'refs/heads/stable'
# defaults:
# run:
# shell: bash -l {0}
# env:
# DOCKERHUB_REPO: "docker.io/scwatts/bactabolize"
# VERSION: ${{ needs.get_version.outputs.version }}
# steps:
# - name: Checkout code
# id: git_checkout
# uses: actions/checkout@v3
# - name: Build Docker image
# run: |
# docker build \
# --tag "${DOCKERHUB_REPO}:${VERSION}" \
# --file docker/Dockerfile \
# ./
# - name: DockerHub auth
# run: |
# echo "${{ secrets.DOCKERHUB_TOKEN }}" | \
# docker login \
# --username "${{ secrets.DOCKERHUB_USERNAME }}" \
# --password-stdin
# - name: DockerHub push
# run: |
# docker push "${DOCKERHUB_REPO}:${VERSION}"