<commit_before>name: Build and push CentOS7 images to Quay.io registry
on:
  push:
    branches:
      - master

jobs:
  build-and-push:
    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        include:
          - dockerfile: "Dockerfile"
            registry_namespace: "centos7"
            os_type: "centos7"
            registry_suffix: "-centos7"
          - dockerfile: "Dockerfile.c9s"
            registry_namespace: "sclorg"
            os_type: "c9s"
            registry_suffix: ""

    steps:
      - uses: actions/checkout@v2

      - name: Set current date as env variable
        run: echo "NOW=$(date +'%Y%m%d')" >> $GITHUB_ENV

      - name: Get base image name
        id: base-image-name
        run: |
          # This command returns row with BASE_IMAGE_NAME
          row=$(grep "BASE_IMAGE_NAME" Makefile)
          # Return only base image name
          BASE_IMAGE_ROW=${row/BASE_IMAGE_NAME = /}
          echo ::set-output name=image_name::$BASE_IMAGE_ROW

      - name: Export GitHub secrets
        run: |
          if [ "${{ matrix.os_type }}" == "centos7" ]; then
            username="${{ secrets.QUAY_IMAGE_BUILDER_USERNAME }}"
            token="${{ secrets.QUAY_IMAGE_BUILDER_TOKEN }}"
          else
            username="${{ secrets.QUAY_IMAGE_SCLORG_BUILDER_USERNAME }}"
            token="${{ secrets.QUAY_IMAGE_SCLORG_BUILDER_TOKEN  }}"
          fi
          echo "USERNAME=$username" >> GITHUB_ENV
          echo "TOKEN=$token" >> GITHUB_ENV

      - name: Build image
        id: build-image
        # https://github.com/marketplace/actions/buildah-build
        uses: redhat-actions/buildah-build@v2
        with:
          dockerfiles: core/${{ matrix.dockerfile }}
          image: ${{ steps.base-image-name.outputs.image_name}}-core${{ matrix.registry_suffix }}
          context: core
          tags: latest c9s ${{ env.NOW }}-${{ github.sha }}

      - name: Push s2i-core image to Quay.io
        id: push-to-quay-core
        uses: redhat-actions/push-to-registry@v2.2
        with:
          image: ${{ steps.build-image-core.outputs.image }}
          tags: ${{ steps.build-image-core.outputs.tags }}
          registry: quay.io/${{ matrix.registry_namespace }}
          username: ${{ env.USERNAME }}
          password: ${{ env.TOKEN }}

      - name: Build s2i-base CentOS7 image
        # Run this job only on success previous one
        if: success()
        id: build-image-base
        # https://github.com/marketplace/actions/buildah-build
        uses: redhat-actions/buildah-build@v2
        with:
          dockerfiles: base/${{ matrix.dockerfile }}
          image: ${{ steps.base-image-name.outputs.image_name}}-base${{ matrix.registry_suffix }}
          context: base
          tags: latest c9s ${{ env.NOW}}-${{ github.sha }}

      - name: Push s2i-base CentOS7 image to Quay.io
        # Run this job only on success previous one
        if: success()
        id: push-to-quay-base
        uses: redhat-actions/push-to-registry@v2.2
        with:
          image: ${{ steps.build-image-base.outputs.image }}
          tags: ${{ steps.build-image-base.outputs.tags }}
          registry: quay.io/${{ matrix.registry_namespace }}
          username: ${{ env.USERNAME }}
          password: ${{ env.TOKEN }}

      - name: Print image url
        run: echo "Image pushed to ${{ steps.push-to-quay-core.outputs.registry-paths }} and ${{ steps.push-to-quay-base.outputs.registry-paths }}"<commit_msg>content for building is root and not core/base<commit_after>name: Build and push CentOS7 images to Quay.io registry
on:
  push:
    branches:
      - master

jobs:
  build-and-push:
    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        include:
          - dockerfile: "Dockerfile"
            registry_namespace: "centos7"
            os_type: "centos7"
            registry_suffix: "-centos7"
          - dockerfile: "Dockerfile.c9s"
            registry_namespace: "sclorg"
            os_type: "c9s"
            registry_suffix: ""

    steps:
      - uses: actions/checkout@v2

      - name: Set current date as env variable
        run: echo "NOW=$(date +'%Y%m%d')" >> $GITHUB_ENV

      - name: Get base image name
        id: base-image-name
        run: |
          # This command returns row with BASE_IMAGE_NAME
          row=$(grep "BASE_IMAGE_NAME" Makefile)
          # Return only base image name
          BASE_IMAGE_ROW=${row/BASE_IMAGE_NAME = /}
          echo ::set-output name=image_name::$BASE_IMAGE_ROW

      - name: Export GitHub secrets
        run: |
          if [ "${{ matrix.os_type }}" == "centos7" ]; then
            username="${{ secrets.QUAY_IMAGE_BUILDER_USERNAME }}"
            token="${{ secrets.QUAY_IMAGE_BUILDER_TOKEN }}"
          else
            username="${{ secrets.QUAY_IMAGE_SCLORG_BUILDER_USERNAME }}"
            token="${{ secrets.QUAY_IMAGE_SCLORG_BUILDER_TOKEN  }}"
          fi
          echo "USERNAME=$username" >> GITHUB_ENV
          echo "TOKEN=$token" >> GITHUB_ENV

      - name: Build image
        id: build-image
        # https://github.com/marketplace/actions/buildah-build
        uses: redhat-actions/buildah-build@v2
        with:
          dockerfiles: core/${{ matrix.dockerfile }}
          image: ${{ steps.base-image-name.outputs.image_name}}-core${{ matrix.registry_suffix }}
          tags: latest c9s ${{ env.NOW }}-${{ github.sha }}

      - name: Push s2i-core image to Quay.io
        id: push-to-quay-core
        uses: redhat-actions/push-to-registry@v2.2
        with:
          image: ${{ steps.build-image-core.outputs.image }}
          tags: ${{ steps.build-image-core.outputs.tags }}
          registry: quay.io/${{ matrix.registry_namespace }}
          username: ${{ env.USERNAME }}
          password: ${{ env.TOKEN }}

      - name: Build s2i-base CentOS7 image
        # Run this job only on success previous one
        if: success()
        id: build-image-base
        # https://github.com/marketplace/actions/buildah-build
        uses: redhat-actions/buildah-build@v2
        with:
          dockerfiles: base/${{ matrix.dockerfile }}
          image: ${{ steps.base-image-name.outputs.image_name}}-base${{ matrix.registry_suffix }}
          tags: latest c9s ${{ env.NOW}}-${{ github.sha }}

      - name: Push s2i-base CentOS7 image to Quay.io
        # Run this job only on success previous one
        if: success()
        id: push-to-quay-base
        uses: redhat-actions/push-to-registry@v2.2
        with:
          image: ${{ steps.build-image-base.outputs.image }}
          tags: ${{ steps.build-image-base.outputs.tags }}
          registry: quay.io/${{ matrix.registry_namespace }}
          username: ${{ env.USERNAME }}
          password: ${{ <PASSWORD> }}

      - name: Print image url
        run: echo "Image pushed to ${{ steps.push-to-quay-core.outputs.registry-paths }} and ${{ steps.push-to-quay-base.outputs.registry-paths }}"
{'fraction_non_alphanumeric': 0.1290137614678899, 'fraction_numerical': 0.007167431192660551, 'mean_word_length': 2.049388111888112, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 16, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '348408', 'n_tokens_mistral': 2205, 'n_tokens_neox': 2125, 'n_words': 455}