-
-
Notifications
You must be signed in to change notification settings - Fork 19
76 lines (72 loc) · 2.82 KB
/
grafana-docker.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
# This is a basic workflow to help you get started with Actions
name: grafana Build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
tags:
- "v*"
paths:
- .github/workflows/grafana-docker.yml
- grafana/**
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
vwsfriend-grafana:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
tillsteinbach/vwsfriend-grafana
ghcr.io/tillsteinbach/vwsfriend-grafana
tags: |
type=edge,
type=pep440,pattern={{version}}
- name: Version from pushed tag
if: startsWith( github.ref, 'refs/tags/v' )
run: |
# from refs/tags/v1.2.3 get 1.2.3
echo "version=$(echo $GITHUB_REF | sed 's#.*/v##')" >> $GITHUB_ENV
- name: Autobump version
if: startsWith( github.ref, 'refs/tags/v' )
working-directory: grafana
run: |
PLACEHOLDER=" \"content\": \"VWsFriend version: \[0.0.0dev\](https://github.com/tillsteinbach/VWsFriend/)\","
REPLACEMENT=" \"content\": \"VWsFriend version: \[${{ env.version }}\](https://github.com/tillsteinbach/VWsFriend/releases/tag/v${{ env.version }})\","
VERSION_FILE="dashboards/vwsfriend/VWsFriend/overview.json"
# ensure the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s|$PLACEHOLDER|$REPLACEMENT|g" "$VERSION_FILE"
grep "$REPLACEMENT" "$VERSION_FILE"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
- name: Login to DockerHub
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6.7.0
with:
context: grafana
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm/v7,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max