Workflow file for this run
This file contains hidden or 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, Publish and Release PyPI and Conda Packages | |
on: | |
release: | |
types: [created] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Build package | |
run: python setup.py sdist bdist_wheel | |
- name: Set environment variables | |
run: | | |
echo "tar_file=$(ls dist/*.tar.gz)" >> $GITHUB_ENV | |
echo "whl_file=$(ls dist/*.whl)" >> $GITHUB_ENV | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Get Release | |
id: get_release | |
uses: bruceadams/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release Asset (.tar.gz) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ${{ env.tar_file }} | |
asset_name: $(basename ${{ env.tar_file }}) | |
asset_content_type: application/gzip | |
- name: Upload Release Asset (.whl) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ${{ env.whl_file }} | |
asset_name: $(basename ${{ env.whl_file }}) | |
asset_content_type: application/zip | |
build: | |
needs: deploy | |
runs-on: ubuntu-latest | |
env: | |
CONDA_BLD_PATH: /usr/share/miniconda/conda-bld/noarch | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: allelefinder_env | |
python-version: 3.9.12 | |
auto-activate-base: false | |
channels: olcbioinformatics,bioconda,conda-forge | |
- name: Install Conda build | |
run: conda install -y conda-build | |
- name: Install conda-verify | |
run: conda install -y conda-verify | |
- name: Set version | |
run: echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | |
- name: Download source code | |
run: wget https://github.com/OLC-Bioinformatics/AlleleFinder/archive/$VERSION.tar.gz | |
- name: Calculate hash | |
run: | | |
echo "HASH=$(sha256sum $VERSION.tar.gz | awk '{ print $1 }')" >> $GITHUB_ENV | |
- name: Update meta.yaml | |
run: | | |
sed -i "s/{{ version }}/${VERSION#v}/g" recipes/meta.yaml | |
sed -i "s|{{ url }}|https://github.com/OLC-Bioinformatics/AlleleFinder/archive/$VERSION.tar.gz|g" recipes/meta.yaml | |
sed -i "s/{{ sha256 }}/$HASH/g" recipes/meta.yaml | |
- name: Build Conda package | |
run: | | |
conda build . | |
- name: Upload Conda package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: allelefinder | |
path: $CONDA_BLD_PATH/noarch/allelefinder-*.tar.bz2 | |
- name: Install anaconda-client | |
run: | | |
conda install -y anaconda-client | |
echo "$(conda info --base)/bin" >> $GITHUB_PATH | |
- name: Upload package to olcbioinformatics | |
run: | | |
anaconda -t ${{ secrets.OLCBIOINFORMATICS_ANACONDA_API_TOKEN }} upload -u olcbioinformatics $CONDA_BLD_PATH/allelefinder-*.tar.bz2 | |
- name: Upload package to adamkoziol | |
run: | | |
anaconda -t ${{ secrets.ADAMKOZIOL_ANACONDA_API_TOKEN }} upload -u adamkoziol $CONDA_BLD_PATH/allelefinder-*.tar.bz2 |