2023-07-28 14:23:32 +02:00
|
|
|
name: Build and cache Docker image
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
actions-id-token-request-url:
|
|
|
|
required: true
|
|
|
|
description: "ACTIONS_ID_TOKEN_REQUEST_URL, issued by GitHub when permission 'id-token' is set to 'write'"
|
2023-10-26 17:50:39 +02:00
|
|
|
save:
|
2023-07-28 14:23:32 +02:00
|
|
|
required: false
|
|
|
|
default: 'false'
|
2023-10-26 17:50:39 +02:00
|
|
|
description: Whether to save the image in the Depot ephemeral registry after building it
|
2023-07-28 14:23:32 +02:00
|
|
|
|
|
|
|
outputs:
|
|
|
|
tag:
|
|
|
|
description: The tag of the image that was built
|
|
|
|
value: ${{ steps.emit.outputs.tag }}
|
2023-10-26 17:50:39 +02:00
|
|
|
build-id:
|
|
|
|
description: The ID of the build
|
|
|
|
value: ${{ steps.build.outputs.build-id }}
|
2023-07-28 14:23:32 +02:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: 'composite'
|
|
|
|
steps:
|
2024-01-22 17:59:21 +01:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2023-07-28 14:23:32 +02:00
|
|
|
- name: Set up Depot CLI
|
|
|
|
uses: depot/setup-action@v1
|
|
|
|
|
|
|
|
- name: Emit image tag
|
|
|
|
id: emit
|
|
|
|
shell: bash
|
|
|
|
run: echo "tag=posthog/posthog:${{ github.sha }}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Build image # We don't push this because we use Depot cache as the communication channel
|
|
|
|
id: build
|
|
|
|
uses: depot/build-push-action@v1
|
|
|
|
with:
|
2024-01-22 17:59:21 +01:00
|
|
|
context: .
|
2023-07-28 14:23:32 +02:00
|
|
|
buildx-fallback: false # buildx is so slow it's better to just fail
|
|
|
|
tags: ${{ steps.emit.outputs.tag }}
|
|
|
|
platforms: linux/amd64,linux/arm64
|
2023-10-06 15:28:25 +02:00
|
|
|
build-args: COMMIT_HASH=${{ github.sha }}
|
2023-10-26 17:50:39 +02:00
|
|
|
save: ${{ inputs.save }}
|
2023-07-28 14:23:32 +02:00
|
|
|
env:
|
|
|
|
ACTIONS_ID_TOKEN_REQUEST_URL: ${{ inputs.actions-id-token-request-url }}
|