Skip to content

Commit

Permalink
!build/doc: revamped build pipeline
Browse files Browse the repository at this point in the history
!+ Build is now separated into three separate workflows:
  - build_alpha that builds the bleeding edge to an :alpha tag available on DockerHub and ghcr (corresponds to the old :beta). This image is automatically re-built fortnightly to include upstream docker images changes.
  - build_beta which builds pre-releases to a :beta tag available on DockerHub and ghcr.
  - build_latest which builds pre-releases to a :latest tag (and its corresponding version tag) available on DockerHub and ghcr.

+ fixed the broken "build" badge in the README and added one badge to each corresponding tag.
  • Loading branch information
fetzu committed Aug 6, 2024
1 parent de7fe2c commit 90ec095
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 18 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build_alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Build for amd64 and arm64 and publish to DockerHub and GitHub Packages
# Bleeding edge of main published as :alpha
# The :alpha image is automatically re-built and pushed fortnightly to include changes to upstream images

name: :alpha

on:
push:
branches:
- 'main'
schedule:
- cron: "37 1 */1,*/14 * *"

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Setup QEMU
uses: docker/[email protected]

- name: Setup buildx
uses: docker/[email protected]

- name: Log in to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the GitHub Packages container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
fetzu/teslamate-abrp
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker image with 'alpha' tag
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
fetzu/teslamate-abrp:alpha,
ghcr.io/${{ github.repository }}:alpha
labels: ${{ steps.meta.outputs.labels }}
64 changes: 64 additions & 0 deletions .github/workflows/build_beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Build for amd64 and arm64 and publish to DockerHub and GitHub Packages
# Pre-release published as :beta

name: :beta

on:
release:
types:
- 'prereleased'
push:
tags:
- 'v*'

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Setup QEMU
uses: docker/[email protected]

- name: Setup buildx
uses: docker/[email protected]

- name: Log in to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the GitHub Packages container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
fetzu/teslamate-abrp
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker images for pre-releases (:beta)
if: github.event_name == 'prereleased'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
${{ steps.meta.outputs.tags }},
fetzu/teslamate-abrp:beta,
ghcr.io/${{ github.repository }}:beta
labels: ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# Build for amd64 and arm64 and publish to DockerHub and GitHub Packages
# The :beta image is automatically re-built and pushed fortnightly to include changes to upstream images
# Latest release published as :latest

name: Build and publish Docker image
name: :latest

on:
release:
types:
- 'published'
push:
branches:
- 'main'
tags:
- 'v*'
schedule:
- cron: "37 1 */1,*/14 * *"

jobs:
push_to_registries:
Expand Down Expand Up @@ -66,14 +62,3 @@ jobs:
fetzu/teslamate-abrp:latest,
ghcr.io/${{ github.repository }}:latest
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker image with 'beta' tag
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
fetzu/teslamate-abrp:beta,
ghcr.io/${{ github.repository }}:beta
labels: ${{ steps.meta.outputs.labels }}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# TeslaMate: MQTT to ABRP
[![amd64+arm64 build](https://github.com/fetzu/teslamate-abrp/actions/workflows/build.yml/badge.svg)](https://github.com/fetzu/teslamate-abrp/actions/workflows/build.yml)
[![amd64+arm64 :alpha build](https://github.com/fetzu/teslamate-abrp/actions/workflows/build_alpha.yml/badge.svg)](https://github.com/fetzu/teslamate-abrp/actions/workflows/build_alpha.yml)
[![amd64+arm64 :beta build](https://github.com/fetzu/teslamate-abrp/actions/workflows/build_beta.yml/badge.svg)](https://github.com/fetzu/teslamate-abrp/actions/workflows/build_beta.yml)
[![amd64+arm64 :latest build](https://github.com/fetzu/teslamate-abrp/actions/workflows/build_latest.yml/badge.svg)](https://github.com/fetzu/teslamate-abrp/actions/workflows/build_latest.yml)
[![](https://img.shields.io/github/v/release/fetzu/teslamate-abrp)](https://github.com/fetzu/teslamate-abrp/releases/latest)
[![](https://img.shields.io/docker/image-size/fetzu/teslamate-abrp/latest)](https://hub.docker.com/r/fetzu/teslamate-abrp)
[![](https://img.shields.io/docker/pulls/fetzu/teslamate-abrp?color=%23099cec)](https://hub.docker.com/r/fetzu/teslamate-abrp)
Expand Down

0 comments on commit 90ec095

Please sign in to comment.