name: Docker Image CI on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Build the Docker image run: docker build . --file Dockerfile --tag xbeeant/oo-unlimit:$(date +%s) - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKER_TOKEN }} - name: Build image and push to Docker Hub and GitHub Container Registry uses: docker/build-push-action@v2 with: # relative path to the place where source code with Dockerfile is located context: ./ # Note: tags has to be all lower-case tags: | xbeeant/devdocs:latest # build on feature branches, push only on main branch push: ${{ github.ref == 'refs/heads/main' }}