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: 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 | |
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: Get version and download source code | |
run: | | |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV # Extract the version from the GitHub tag | |
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/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 | |
- name: Upload package to olcbioinformatics | |
run: | | |
anaconda -t ${{ secrets.OLCBIOINFORMATICS_ANACONDA_API_TOKEN }} upload -u olcbioinformatics $CONDA_BLD_PATH/noarch/allelefinder-*.tar.bz2 | |
- name: Upload package to adamkoziol | |
run: | | |
anaconda -t ${{ secrets.ADAMKOZIOL_ANACONDA_API_TOKEN }} upload -u adamkoziol $CONDA_BLD_PATH/noarch/allelefinder-*.tar.bz2 |