Conda and Docker Update #7
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: Conda and Docker Update | |
on: | |
release: | |
types: [published] | |
jobs: | |
build-and-upload-conda: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Code | |
uses: actions/checkout@v2 | |
- name: Extract Version from Tag | |
shell: bash | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/v} # Strip 'refs/tags/v' to get the version number | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
echo "Stripped version: ${VERSION}" | |
- name: Set Package Version | |
shell: bash | |
run: | | |
echo "__version__ = '${{ env.VERSION }}'" > ./version.py | |
- name: Update Version in Conda Recipe | |
shell: bash | |
run: | | |
sed -i "s/\$VERSION/${{ env.VERSION }}/g" conda-recipe/meta.yaml | |
- name: Set up Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
activate-environment: build-env | |
python-version: "3.10" | |
miniconda-version: latest | |
- name: Build Conda Package | |
shell: bash -l {0} | |
run: | | |
conda install conda-build anaconda-client conda-verify | |
conda build conda-recipe --output-folder ./build -c ecoevoinfo -c conda-forge -c bioconda | |
- name: Upload Conda Package to Anaconda Cloud | |
shell: bash -l {0} | |
env: | |
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
run: | | |
anaconda upload --user ecoevoinfo --label main ./build/noarch/*.tar.bz2 | |
build-and-push-docker: | |
needs: build-and-upload-conda | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
push: true | |
tags: | | |
tkchafin/autostreamtree:latest | |
tkchafin/autostreamtree:${{ env.VERSION }} # Use stripped version |