OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-docker / .github / workflows / publish-images.yml

153 lines · yaml ref:
name: Publish images

on:
  pull_request:
    branches: [ "master" ]
    paths:
      - "opencog/**"
      - ".github/workflows/**"
  push:
    branches: [ "master" ]
    paths:
      - "opencog/**"
      - ".github/workflows/**"
  schedule:
    - cron: "37 2 * * 6"  # Run 2:37 AM Saturday night. `man 5 crontab`
  workflow_dispatch:

jobs:

  # The job is called "base-images".
  # The Dockerfile is located in the directory opencog/base
  #     -- this is the "context"
  # The name of the docker image is opencog/opencog-deps:latest
  base-images:
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout current repo
        uses: actions/checkout@v6

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Login to DockerHub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

      - name: Build and push opencog-deps to docker hub
        uses: docker/build-push-action@v6
        with:
          context: opencog/base
          tags: ${{ secrets.DOCKER_NAMESPACE }}/opencog-deps:latest
          push: true

  # Needs is the name of the job, above.
  atomspace:
    needs: base-images
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout current repo
        uses: actions/checkout@v6

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Login to DockerHub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

      - name: Build and push to docker hub
        uses: docker/build-push-action@v6
        with:
          context: opencog/${{ github.job }}
          tags: ${{ secrets.DOCKER_NAMESPACE }}/${{ github.job }}:latest
          push: true

      - name: This is the droid you are looking for!
        if: always()
        run: |
          echo "### Advice to the Lovelorn :rocket:" >> $GITHUB_STEP_SUMMARY
          echo "If the build failed, click on the job, then click on the gear icon and then click 'View raw logs'." >> $GITHUB_STEP_SUMMARY

      # This places a message at the top of the job page, but you have
      # to click through to see the message, so it seems useless...
      # - name: Testing! Testing! 1,2,3.
      #   run: |
      #     echo "::notice title=Your-name-here::check check"


  atomspace-py:
    needs: atomspace
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout current repo
        uses: actions/checkout@v6

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Login to DockerHub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

      - name: Build and push to docker hub
        uses: docker/build-push-action@v6
        with:
          context: opencog/${{ github.job }}
          tags: ${{ secrets.DOCKER_NAMESPACE }}/${{ github.job }}:latest
          push: true

  learn:
    needs: atomspace
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout current repo
        uses: actions/checkout@v6

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Login to DockerHub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

      - name: Build and push to docker hub
        uses: docker/build-push-action@v6
        with:
          context: opencog/${{ github.job }}
          tags: ${{ secrets.DOCKER_NAMESPACE }}/${{ github.job }}:latest
          push: true

# TODO: Create dockerfile & publish an as-moses image.
#  as-moses:
#    needs: atomspace
#    runs-on: ubuntu-24.04
#    steps:
#      - name: Checkout current repo
#        uses: actions/checkout@v6
#
#      - name: Set up Docker Buildx
#        uses: docker/setup-buildx-action@v3
#
#      - name: Login to DockerHub
#        uses: docker/login-action@v3
#        with:
#          username: ${{ secrets.DOCKER_USERNAME }}
#          password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
#
#      - name: Build and push to docker hub
#        uses: docker/build-push-action@v6
#        with:
# XXX wrong context, fixme.
#          context: archive/${{ github.job }}
#          tags: ${{ secrets.DOCKER_NAMESPACE }}/${{ github.job }}:latest
#          push: true