-
Notifications
You must be signed in to change notification settings - Fork 750
110 lines (99 loc) · 3.7 KB
/
ghcr_build.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build GHCR images
on:
pull_request_target:
branches: ["master", "ci"]
paths:
- "**/*"
- "!.github/**" # Important: Exclude PRs related to .github from auto-run
- "!.github/workflows/**" # Important: Exclude PRs related to .github/workflows from auto-run
- "!.github/actions/**" # Important: Exclude PRs related to .github/actions from auto-run
env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
permissions:
contents: read
packages: write
jobs:
check_paths:
uses: ./.github/workflows/check_paths.yml
teslamate_build:
name: Build images
needs: check_paths
if: needs.check_paths.outputs.githubfolder != 'true'
strategy:
fail-fast: false
matrix:
include:
- platform: "linux/amd64"
runs_on: "ubuntu-24.04"
cache_id: amd64
- platform: "linux/arm/v7"
runs_on: "buildjet-2vcpu-ubuntu-2204-arm"
cache_id: arm
- platform: "linux/arm64"
runs_on: "buildjet-2vcpu-ubuntu-2204-arm"
cache_id: arm64
runs-on: ${{ matrix.runs_on }}
timeout-minutes: 10
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
if: ${{ github.event_name != 'pull_request_target' }}
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
if: ${{ github.event_name == 'pull_request_target' }}
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Buildx
uses: ./.github/actions/build
with:
docker_password: ${{ secrets.DOCKER_PASSWORD }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ github.ref_name }}
labels: |
org.opencontainers.image.version=${{ github.ref || github.ref_name }}
teslamate_merge:
name: Merge GHCR images
needs:
- check_paths
- teslamate_build
if: needs.check_paths.outputs.githubfolder != 'true'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Merge
id: merge
uses: ./.github/actions/merge
with:
image: ${{ env.REGISTRY_IMAGE }}
grafana:
needs: check_paths
if: needs.check_paths.outputs.githubfolder != 'true'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
if: ${{ github.event_name != 'pull_request_target' }}
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
if: ${{ github.event_name == 'pull_request_target' }}
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/grafana
with:
image: ${{ env.REGISTRY_IMAGE }}/grafana
labels: |
org.opencontainers.image.version=${{ github.ref || github.ref_name }}