diff --git a/.github/actions/build-container/action.yml b/.github/actions/build-container/action.yml index 72a9cfb..c351b28 100644 --- a/.github/actions/build-container/action.yml +++ b/.github/actions/build-container/action.yml @@ -7,6 +7,14 @@ inputs: tag: description: 'Tag suffix for the image' required: true + image-subdir: + description: 'Subdirectory to push image to' + default: 'cache' + +outputs: + container-image-adress: + description: Address of container image + value: ${{ steps.set-image.outputs.image }} runs: using: "composite" @@ -14,6 +22,14 @@ runs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Set image names + id: set-image + shell: bash + run: | + image="ghcr.io/${{ github.repository }}/${{ inputs.image-subdir }}:${{ inputs.tag }}" + echo "image=$image" >> $GITHUB_OUTPUT + echo "cache_image=${image}-cache" >> $GITHUB_OUTPUT + - name: Log in to the Container registry uses: docker/login-action@v3 with: @@ -27,6 +43,6 @@ runs: context: . file: ${{ inputs.dockerfile }} push: true - tags: ghcr.io/${{ github.repository }}:${{ inputs.tag }} - cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ inputs.tag }}-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:${{ inputs.tag }}-cache,mode=max \ No newline at end of file + tags: ${{ steps.set-image.outputs.image }} + cache-from: type=registry,ref=${{ steps.set-image.outputs.cache_image }} + cache-to: type=registry,ref=${{ steps.set-image.outputs.cache_image }},mode=max \ No newline at end of file diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7f4c5c0..4ea8656 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -3,7 +3,6 @@ name: Build & Test on: push: { branches: ["master", "_master/add_ci"] } pull_request: { branches: ["master"] } - workflow_dispatch: permissions: { contents: read, packages: write } diff --git a/.github/workflows/linux-pipeline.yml b/.github/workflows/linux-pipeline.yml index f3047f3..65ced60 100644 --- a/.github/workflows/linux-pipeline.yml +++ b/.github/workflows/linux-pipeline.yml @@ -21,20 +21,23 @@ jobs: prepare: name: Build Container (${{ inputs.backend }}) runs-on: ubuntu-latest + outputs: + container-image-adress: ${{ steps.build.outputs.container-image-adress }} steps: - uses: actions/checkout@v4 - - name: Build & Push + - id: build + name: Build & Push uses: ./.github/actions/build-container with: dockerfile: ci/docker/linux/Dockerfile.${{ inputs.backend }} - tag: linux-${{ inputs.backend }} + tag: linux-${{ inputs.backend }}-container build: name: Linux (${{ inputs.compiler }}-${{ inputs.backend }}) needs: prepare runs-on: ubuntu-latest container: - image: ghcr.io/${{ github.repository }}:linux-${{ inputs.backend }} + image: ${{ needs.prepare.outputs.container-image-adress }} credentials: username: ${{ github.actor }} password: ${{ github.token }}