Bump docker/build-push-action from 5.1.0 to 6.5.0 #387
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/[email protected] | |
- name: Login to DockerHub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/[email protected] | |
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 |