-
Notifications
You must be signed in to change notification settings - Fork 1.3k
75 lines (63 loc) · 2.51 KB
/
container-images-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Container Images CI
on:
pull_request:
paths-ignore:
- 'rust/**'
- 'livestream/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
posthog_build:
name: Build Docker image
runs-on: ubuntu-latest
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@v3
if: github.actor != 'posthog-bot'
with:
token: ${{ secrets.GITHUB_TOKEN }}
workflow: .github/workflows/storybook-chromatic.yml
- uses: n1hility/cancel-previous-runs@v3
if: github.actor != 'posthog-bot'
with:
token: ${{ secrets.GITHUB_TOKEN }}
workflow: .github/workflows/ci-backend.yml
- name: Check out
uses: actions/checkout@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 }}
deploy_preview:
name: Deploy preview environment
uses: ./.github/workflows/pr-deploy.yml
needs: [posthog_build]
secrets: inherit
if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }}
lint:
name: Lint changed Dockerfiles
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check if any Dockerfile has changed
id: changed-files
uses: tj-actions/changed-files@v43
with:
files: |
**/Dockerfile
**/*.Dockerfile
**/Dockerfile.*
separator: ' '
- name: Lint changed Dockerfile(s) with Hadolint
uses: jbergstroem/hadolint-gh-action@v1
if: steps.changed-files.outputs.any_changed == 'true'
with:
dockerfile: '${{ steps.changed-files.outputs.all_modified_files }}'