Update README.md #54
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: Build CarnaPy and Docker image | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'dev**' | |
tags: | |
- '**' | |
jobs: | |
build_carnapy: | |
name: Build CarnaPy | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Git checkout | |
uses: actions/checkout@v2 | |
- | |
name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniconda-version: 'latest' | |
python-version: '3.10' | |
channels: conda-forge, defaults | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
auto-update-conda: true | |
auto-activate-base: true | |
- | |
name: Set environment variables | |
run: echo "CONDA_PREFIX=$CONDA" >> $GITHUB_ENV | |
- | |
name: Build dist | |
run: sh linux_build.sh | |
- | |
name: Collect artifact data | |
run: | | |
mkdir /tmp/dist | |
cp /usr/local/lib/libCarna-*.so /tmp/dist | |
rm /tmp/dist/libCarna-*d.so | |
cp $(find /home/runner/work -name '*.whl') /tmp/dist/ | |
- | |
name: Build and upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: | | |
/tmp/dist | |
build_docker: | |
name: Build Docker image | |
needs: build_carnapy | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Git checkout | |
uses: actions/checkout@v2 | |
- | |
name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
- | |
name: Inspect working directory | |
run: tree . | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Setup repository name | |
id: setup_repository_name | |
run: | | |
echo "docker_repository=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
file: .github/Dockerfile | |
context: . | |
push: true | |
tags: ${{ steps.setup_repository_name.outputs.docker_repository }}:${{ github.ref_name }} |