Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): use the published resolve-release action (#105062)

Aleksander Błaszkiewicz3c3b6eac5da3
diff --git a/.depot/actions/resolve-error-tracking-release/action.yml b/.depot/actions/resolve-error-tracking-release/action.yml
deleted file mode 100644
index 2bd826baeb01..000000000000
--- a/.depot/actions/resolve-error-tracking-release/action.yml
+++ /dev/null
@@ -1,78 +0,0 @@
-name: Resolve error tracking release
-description: Create the error tracking release for this build, or find it when it exists, and output its id for the image build to bake in as POSTHOG_RELEASE_ID.
-
-inputs:
- api-key:
- required: true
- description: 'Personal API key with the error_tracking:write scope. When empty, nothing runs and the output stays empty.'
- project-id:
- required: false
- default: '2'
- description: 'Id of the project that owns the release.'
- release-name:
- required: false
- default: 'posthog'
- description: 'Name of the release. Must match the --release-name the sourcemap stage of the Dockerfile passes, so both find one release.'
- release-version:
- required: true
- description: 'Version of the release, normally the commit sha. Must match the --release-version the sourcemap stage of the Dockerfile passes.'
-
-outputs:
- release-id:
- description: 'Id of the release, or empty when none was resolved.'
- value: ${{ steps.resolve.outputs.release-id }}
-
-runs:
- using: 'composite'
- steps:
- # Never fails on its own: without a key, or on a download, checksum, or API error, the id
- # stays empty and a warning says so. A caller that must not block on this step adds
- # continue-on-error and a timeout on its `uses:` step, because a composite step cannot
- # carry a timeout itself.
- - name: Resolve release
- id: resolve
- shell: bash
- env:
- # The CLI installer is pinned to an immutable release tag and checksum-verified before
- # execution. The Dockerfile pins its own copy for the sourcemap stage, and the two do
- # not have to match: both sides find the release by its name and version. To upgrade,
- # change the version and recompute the hash:
- # curl -LsSf "https://github.com/PostHog/posthog/releases/download/posthog-cli%2Fv<X.Y.Z>/posthog-cli-installer.sh" | sha256sum
- POSTHOG_CLI_VERSION: 0.18.2
- POSTHOG_CLI_INSTALLER_SHA256: 1ed5ff785ca33f38458efb1677ffd35ed99d935ac59d5e28bfd0d07a4f697f7a
- POSTHOG_CLI_TOKEN: ${{ inputs.api-key }}
- POSTHOG_CLI_ENV_ID: ${{ inputs.project-id }}
- POSTHOG_CLI_INSTALL_DIR: ${{ runner.temp }}/posthog-cli
- POSTHOG_CLI_NO_MODIFY_PATH: '1'
- # The CLI stamps the release with git metadata (branch, commit, repo) read from these.
- # GitHub Actions exports them already. Depot CI, which runs the outage image build,
- # may not, so they come from the context here.
- GITHUB_ACTIONS: 'true'
- GITHUB_SHA: ${{ github.sha }}
- GITHUB_REF_NAME: ${{ github.ref_name }}
- GITHUB_REPOSITORY: ${{ github.repository }}
- GITHUB_SERVER_URL: ${{ github.server_url }}
- RELEASE_NAME: ${{ inputs.release-name }}
- RELEASE_VERSION: ${{ inputs.release-version }}
- run: |
- release_id=""
- if [ -n "$POSTHOG_CLI_TOKEN" ]; then
- # Explicit && chaining, not set -e: bash ignores errexit inside a command
- # substitution that || guards, so a failed download or checksum would
- # otherwise fall through to running the installer.
- release_id="$(
- installer="$RUNNER_TEMP/posthog-cli-installer.sh" &&
- curl --proto '=https' --tlsv1.2 -fsSL --retry 5 --retry-all-errors --retry-max-time 60 --connect-timeout 10 \
- -o "$installer" \
- "https://github.com/PostHog/posthog/releases/download/posthog-cli%2Fv${POSTHOG_CLI_VERSION}/posthog-cli-installer.sh" &&
- echo "${POSTHOG_CLI_INSTALLER_SHA256} ${installer}" | sha256sum -c - >&2 &&
- sh "$installer" >&2 &&
- "$POSTHOG_CLI_INSTALL_DIR/posthog-cli" release resolve \
- --release-name "$RELEASE_NAME" \
- --release-version "$RELEASE_VERSION"
- )" || release_id=""
- fi
- if [ -z "$release_id" ]; then
- echo "::warning::No error tracking release resolved; the image ships without POSTHOG_RELEASE_ID"
- fi
- echo "release-id=$release_id" >> "$GITHUB_OUTPUT"
diff --git a/.depot/workflows/actions-outage-image-build.yml b/.depot/workflows/actions-outage-image-build.yml
index c3666a97a024..09b04c376314 100644
--- a/.depot/workflows/actions-outage-image-build.yml
+++ b/.depot/workflows/actions-outage-image-build.yml
@@ -55,16 +55,18 @@ jobs:
# Same step as in container-images-cd.yml, so an image built during an outage links
# backend exceptions to its release like a normal build does. Never blocks the build:
- # the action turns the expected failures into an empty id with a warning, and
- # continue-on-error plus the timeout cover the rest. An empty id is fine: the SDK
- # treats a blank value as unset.
+ # without the secret the action passes with an empty id, and continue-on-error plus the
+ # timeout cover a failed or hung call. An empty id is fine: the SDK treats a blank value
+ # as unset.
- name: Resolve error tracking release
id: release
continue-on-error: true
timeout-minutes: 5
- uses: ./.depot/actions/resolve-error-tracking-release
+ uses: PostHog/resolve-release@52d3bea6f86a713545874057b7d4bfebb6b5f367 # v1.0.0
with:
api-key: ${{ secrets.POSTHOG_UPLOAD_SOURCEMAPS_CLI_API_KEY }}
+ project-id: '2'
+ release-name: posthog
release-version: ${{ github.sha }}
- name: Build and push
diff --git a/.github/actions/resolve-error-tracking-release/action.yml b/.github/actions/resolve-error-tracking-release/action.yml
deleted file mode 100644
index 2bd826baeb01..000000000000
--- a/.github/actions/resolve-error-tracking-release/action.yml
+++ /dev/null
@@ -1,78 +0,0 @@
-name: Resolve error tracking release
-description: Create the error tracking release for this build, or find it when it exists, and output its id for the image build to bake in as POSTHOG_RELEASE_ID.
-
-inputs:
- api-key:
- required: true
- description: 'Personal API key with the error_tracking:write scope. When empty, nothing runs and the output stays empty.'
- project-id:
- required: false
- default: '2'
- description: 'Id of the project that owns the release.'
- release-name:
- required: false
- default: 'posthog'
- description: 'Name of the release. Must match the --release-name the sourcemap stage of the Dockerfile passes, so both find one release.'
- release-version:
- required: true
- description: 'Version of the release, normally the commit sha. Must match the --release-version the sourcemap stage of the Dockerfile passes.'
-
-outputs:
- release-id:
- description: 'Id of the release, or empty when none was resolved.'
- value: ${{ steps.resolve.outputs.release-id }}
-
-runs:
- using: 'composite'
- steps:
- # Never fails on its own: without a key, or on a download, checksum, or API error, the id
- # stays empty and a warning says so. A caller that must not block on this step adds
- # continue-on-error and a timeout on its `uses:` step, because a composite step cannot
- # carry a timeout itself.
- - name: Resolve release
- id: resolve
- shell: bash
- env:
- # The CLI installer is pinned to an immutable release tag and checksum-verified before
- # execution. The Dockerfile pins its own copy for the sourcemap stage, and the two do
- # not have to match: both sides find the release by its name and version. To upgrade,
- # change the version and recompute the hash:
- # curl -LsSf "https://github.com/PostHog/posthog/releases/download/posthog-cli%2Fv<X.Y.Z>/posthog-cli-installer.sh" | sha256sum
- POSTHOG_CLI_VERSION: 0.18.2
- POSTHOG_CLI_INSTALLER_SHA256: 1ed5ff785ca33f38458efb1677ffd35ed99d935ac59d5e28bfd0d07a4f697f7a
- POSTHOG_CLI_TOKEN: ${{ inputs.api-key }}
- POSTHOG_CLI_ENV_ID: ${{ inputs.project-id }}
- POSTHOG_CLI_INSTALL_DIR: ${{ runner.temp }}/posthog-cli
- POSTHOG_CLI_NO_MODIFY_PATH: '1'
- # The CLI stamps the release with git metadata (branch, commit, repo) read from these.
- # GitHub Actions exports them already. Depot CI, which runs the outage image build,
- # may not, so they come from the context here.
- GITHUB_ACTIONS: 'true'
- GITHUB_SHA: ${{ github.sha }}
- GITHUB_REF_NAME: ${{ github.ref_name }}
- GITHUB_REPOSITORY: ${{ github.repository }}
- GITHUB_SERVER_URL: ${{ github.server_url }}
- RELEASE_NAME: ${{ inputs.release-name }}
- RELEASE_VERSION: ${{ inputs.release-version }}
- run: |
- release_id=""
- if [ -n "$POSTHOG_CLI_TOKEN" ]; then
- # Explicit && chaining, not set -e: bash ignores errexit inside a command
- # substitution that || guards, so a failed download or checksum would
- # otherwise fall through to running the installer.
- release_id="$(
- installer="$RUNNER_TEMP/posthog-cli-installer.sh" &&
- curl --proto '=https' --tlsv1.2 -fsSL --retry 5 --retry-all-errors --retry-max-time 60 --connect-timeout 10 \
- -o "$installer" \
- "https://github.com/PostHog/posthog/releases/download/posthog-cli%2Fv${POSTHOG_CLI_VERSION}/posthog-cli-installer.sh" &&
- echo "${POSTHOG_CLI_INSTALLER_SHA256} ${installer}" | sha256sum -c - >&2 &&
- sh "$installer" >&2 &&
- "$POSTHOG_CLI_INSTALL_DIR/posthog-cli" release resolve \
- --release-name "$RELEASE_NAME" \
- --release-version "$RELEASE_VERSION"
- )" || release_id=""
- fi
- if [ -z "$release_id" ]; then
- echo "::warning::No error tracking release resolved; the image ships without POSTHOG_RELEASE_ID"
- fi
- echo "release-id=$release_id" >> "$GITHUB_OUTPUT"
diff --git a/.github/workflows/container-images-cd.yml b/.github/workflows/container-images-cd.yml
index f55de1e374ce..ae3d3cc31716 100644
--- a/.github/workflows/container-images-cd.yml
+++ b/.github/workflows/container-images-cd.yml
@@ -180,18 +180,22 @@ jobs:
# The Python SDK sends that id as $release_id on every event, which links a backend
# exception to the same release the frontend bundles carry: the sourcemap stage of the
# Dockerfile resolves the release by the same name and version, so it finds this one.
- # This step must never block a deploy. The action turns the expected failures (no secret,
- # a download, checksum, or API error) into an empty id with a warning. continue-on-error
- # and the step timeout cover what the action does not catch, such as a hung API call.
- # An empty id is fine: the SDK treats a blank value as unset.
+ # Keep release-name and release-version equal to the --release-name and --release-version
+ # of that stage.
+ # This step must never block a deploy. Without the secret, the action passes with an empty
+ # id and a warning. A download, checksum, or API error fails the step, and
+ # continue-on-error keeps the build going with an empty id. The step timeout stops a hung
+ # API call. An empty id is fine: the SDK treats a blank value as unset.
- name: Resolve error tracking release
id: release
if: steps.preflight.outputs.digest == ''
continue-on-error: true
timeout-minutes: 5
- uses: ./.github/actions/resolve-error-tracking-release
+ uses: PostHog/resolve-release@52d3bea6f86a713545874057b7d4bfebb6b5f367 # v1.0.0
with:
api-key: ${{ secrets.POSTHOG_UPLOAD_SOURCEMAPS_CLI_API_KEY }}
+ project-id: '2'
+ release-name: posthog
release-version: ${{ github.sha }}
- name: Build and push container image