diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 523a55a2..35568bcf 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,14 +1,21 @@ name: Build, Run and Test Docker Image -on: [push] +on: + push: + branches: + - main + pull_request: + branches: + - main jobs: build-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7 + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Setup .netrc + - name: Setup nexus authentication run: | echo "machine nexus.alfresco.com" >> ~/.netrc echo "login ${{ secrets.NEXUS_USERNAME }}" >> ~/.netrc @@ -19,13 +26,13 @@ jobs: working-directory: ${{ github.workspace }} - name: Set up QEMU - uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # 3.1.0 + uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # 3.4.0 + uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # v3.4.0 - - name: Login to Docker Hub - uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # 3.2.0 + - name: Login to Quay.io + uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 with: registry: quay.io username: ${{ secrets.QUAY_USERNAME }} @@ -34,17 +41,17 @@ jobs: - name: Bake Docker images uses: docker/bake-action@eac74531aa56a9266bfedfe5edb6b851ce2cca2b # v5.4.0 - - name: Show all images + - name: Show all built images run: docker images - - name: Docker save the images produced by the bake action with the name consisting alfresco + - name: Docker save all baked images whose name include `alfresco` run: | docker save -o /tmp/alfresco-docker-images.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco) - - name: Upload image as a tar for next job - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # 4.3.4 + - name: Upload images as artifact + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: - name: ${{ github.run_number }} + name: docker-images path: /tmp/alfresco-docker-images.tar compose-test: @@ -56,13 +63,13 @@ jobs: docker-compose-file: [docker-compose.yml, docker-compose-components.yml] steps: - name: Set up Docker Buildx - uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # 3.4.0 + uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # v3.4.0 - name: Download artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: path: /tmp - name: "${{ github.run_number }}" + name: docker-images - name: Load Docker images run: |