diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml new file mode 100644 index 0000000..0f40553 --- /dev/null +++ b/.github/workflows/docker-build.yaml @@ -0,0 +1,31 @@ +name: Build docker image + +on: + workflow_call: + inputs: + push: + description: Indicates if the docker image has to be pushed + type: boolean + default: false + outputs: + image-tag: + description: Image tag used + value: ${{ github.event.pull_request.head.sha || github.sha }} + +defaults: + run: + shell: bash + +jobs: + build: + name: Docker Build 🐋 + runs-on: x1-core + permissions: + id-token: write + contents: read + packages: write + steps: + - name: Docker build + uses: cloudbeds/composite-actions/docker/build-push/remote@v2 + with: + push: ${{ inputs.push }} diff --git a/.github/workflows/merge-main.yaml b/.github/workflows/merge-main.yaml index 6307c6d..6168a4f 100644 --- a/.github/workflows/merge-main.yaml +++ b/.github/workflows/merge-main.yaml @@ -10,13 +10,7 @@ on: jobs: build-push: name: Build and push application image - runs-on: x1-core - permissions: - id-token: write - contents: read - steps: - - - name: Build and push application image - uses: cloudbeds/composite-actions/docker/build-push/remote@v2 - with: - push: true + uses: ./.github/workflows/docker-build.yaml + secrets: inherit + with: + push: true diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 0000000..b0882fe --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,21 @@ +name: Pull Request + +on: + pull_request: + +# Cancel existing workflows running for this PR +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + docker-build: + name: Docker Build + uses: ./.github/workflows/docker-build.yaml + secrets: inherit + with: + push: false