Skip to content

Commit

Permalink
feat: update version and hash retrieval in GitHub Actions workflow
Browse files Browse the repository at this point in the history
Change the way the version and hash are obtained in the GitHub Actions workflow.

Now, the version is obtained directly from the Python package and the hash is calculated from the downloaded GitHub source code archive.

This simplifies the workflow by removing the need to upload and download the hash as an artifact.

chore: bump version number to 0.3.7
  • Loading branch information
adamkoziol committed May 6, 2024
1 parent abbdf7e commit 74304ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
28 changes: 9 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ jobs:
run: |
echo "tar_file=$(ls dist/*.tar.gz)" >> $GITHUB_ENV
echo "whl_file=$(ls dist/*.whl)" >> $GITHUB_ENV
- name: Calculate hash
run: |
echo "$(shasum -a 256 dist/*.tar.gz | cut -d ' ' -f 1)" > hash.txt
- name: Upload hash as artifact
uses: actions/upload-artifact@v2
with:
name: hash
path: hash.txt
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down Expand Up @@ -75,20 +67,18 @@ jobs:
channels: olcbioinformatics,bioconda,conda-forge
- name: Install Conda build
run: conda install -y conda-build
- name: Download hash artifact
uses: actions/download-artifact@v2
with:
name: hash
- name: Read hash
id: read_hash
- name: Get version and download source code
run: |
echo "VERSION=$(python -c "from allele_tools import version; print(version.__version__)")" >> $GITHUB_ENV
wget https://github.com/OLC-Bioinformatics/AlleleFinder/archive/${VERSION}.tar.gz
- name: Calculate hash
run: |
echo "HASH=$(cat hash.txt)" >> $GITHUB_ENV
echo "HASH=$(sha256sum AlleleFinder-${VERSION}.tar.gz | awk '{ print $1 }')" >> $GITHUB_ENV
- name: Update meta.yaml
run: |
VERSION=$(python -c "from allele_tools import version; print(version.__version__)")
sed -i "s/{{ version }}/${VERSION}/g" recipes/meta.yaml
sed -i "s|{{ url }}|https://files.pythonhosted.org/packages/source/a/allelefinder/allelefinder-${VERSION}.tar.gz|g" recipes/meta.yaml
sed -i "s/{{ sha256 }}/${{ env.HASH }}/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 .
Expand All @@ -101,7 +91,7 @@ jobs:
run: conda install -y anaconda-client
- name: Upload package to olcbioinformatics
run: |
anaconda -t ${{ secrets.OLCBIOINFORMAT_ANACONDA_API_TOKEN }} upload -u olcbioinformatics $CONDA_BLD_PATH/noarch/allelefinder-*.tar.bz2
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
2 changes: 1 addition & 1 deletion allele_tools/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
AlleleFinder version
"""
__version__ = '0.3.6'
__version__ = '0.3.7'

0 comments on commit 74304ef

Please sign in to comment.