Skip to content

Container Images CI #15

Container Images CI

Container Images CI #15

name: Container Images CI
on:
pull_request:
paths-ignore:
- 'rust/**'
- 'livestream/**'
workflow_dispatch:
inputs:
clickhouseServerVersion:
description: ClickHouse server version. Leave blank for default
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
posthog_build:
name: Build Docker image
# run these on 4, if they're RAM constrained the FE build will fail randomly in Docker build
runs-on: bp-ubuntu-latest-x64-4x
permissions:
id-token: write # allow issuing OIDC tokens for this workflow run
contents: read # allow at least reading the repo contents, add other permissions if necessary
steps:
# If this run wasn't initiated by PostHog Bot (meaning: snapshot update),
# cancel previous runs of snapshot update-inducing workflows
- uses: n1hility/cancel-previous-runs@e709d8e41b16d5d0b8d529d293c5e126c57dc022 # v3
if: github.actor != 'posthog-bot'
with:
token: ${{ secrets.GITHUB_TOKEN }}
workflow: .github/workflows/storybook-chromatic.yml
- uses: n1hility/cancel-previous-runs@e709d8e41b16d5d0b8d529d293c5e126c57dc022 # v3
if: github.actor != 'posthog-bot'
with:
token: ${{ secrets.GITHUB_TOKEN }}
workflow: .github/workflows/ci-backend.yml
- name: Check out
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: Build and cache Docker image in Depot
uses: ./.github/actions/build-n-cache-image
with:
actions-id-token-request-url: ${{ env.ACTIONS_ID_TOKEN_REQUEST_URL }}
push-image: false
aws-access-key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-access-secret: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
dockerhub-username: buildpulseapp
dockerhub-password: ${{ secrets.BP_DOCKERHUB_TOKEN }}
pr-number: ${{ github.event.number }}
no-cache: true
deploy_preview:
name: Deploy preview environment
uses: ./.github/workflows/pr-preview-deploy.yml
needs: [posthog_build]
secrets: inherit
if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }}
lint:
name: Lint changed Dockerfiles
runs-on: bp-ubuntu-latest-x64-4x
steps:
- name: Check out
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
fetch-depth: 0
- name: Check if any Dockerfile has changed
id: changed-files
uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45
with:
files: |
**/Dockerfile
**/*.Dockerfile
**/Dockerfile.*
separator: ' '
- name: Lint changed Dockerfile(s) with Hadolint
uses: jbergstroem/hadolint-gh-action@39e57273ed8f513872326b228217828be6a42730 # v1
if: steps.changed-files.outputs.any_changed == 'true'
with:
dockerfile: '${{ steps.changed-files.outputs.all_modified_files }}'