Merge pull request #39 from Kitware/tas/update-metadata #123
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: Docker | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v* | |
| # schedule: | |
| # - cron: '0 16 * * *' # Every day at 16:00 UTC (~09:00 PT) | |
| jobs: | |
| # Push container image to GitHub Packages and Docker Hub. | |
| # See also https://docs.docker.com/docker-hub/builds/ | |
| deploy: | |
| name: Docker image build | |
| runs-on: ubuntu-latest | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| DOCKER_CLI_EXPERIMENTAL: enabled | |
| steps: | |
| - name: Checkout code | |
| uses: nschloe/action-cached-lfs-checkout@v1.2.3 | |
| with: | |
| exclude: "examples/example[2-4].wav" | |
| - uses: docker/setup-qemu-action@v3 | |
| name: Set up QEMU | |
| id: qemu | |
| - uses: docker/setup-buildx-action@v3 | |
| name: Set up Docker Buildx | |
| id: buildx | |
| - name: Available platforms | |
| run: echo ${{ steps.buildx.outputs.platforms }} | |
| # Log into container registries | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ vars.BATBOT_DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.BATBOT_DOCKERHUB_TOKEN }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Push bleeding-edge image ("<branch name>" tag) to registries | |
| - name: Bleeding Edge Docker Hub (Default Option) | |
| run: | | |
| TAG=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/') | |
| echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV | |
| # Push nightly image ("nightly" tag) to registries | |
| - name: Nightly Docker Hub | |
| if: github.event_name == 'schedule' | |
| run: | | |
| echo "IMAGE_TAG=nightly" >> $GITHUB_ENV | |
| # Push tagged image ("<symantic version>" tag) to registries | |
| - name: Tagged Docker Hub | |
| if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }} | |
| run: | | |
| VERSION=$(echo ${GITHUB_REF} | sed 's#.*/v##') | |
| echo "IMAGE_TAG=${VERSION}" >> $GITHUB_ENV | |
| # Build images | |
| - name: Build Batbot | |
| run: | | |
| docker buildx build \ | |
| -t kitware/batbot:${{ env.IMAGE_TAG }} \ | |
| -t ghcr.io/kitware/batbot:${{ env.IMAGE_TAG }} \ | |
| --platform linux/amd64 \ | |
| --push \ | |
| . | |
| # Also push latest image | |
| - name: Build Batbot | |
| if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }} | |
| run: | | |
| docker buildx build \ | |
| -t kitware/batbot:latest \ | |
| -t ghcr.io/kitware/batbot:latest \ | |
| --platform linux/amd64 \ | |
| --push \ | |
| . |