mirror of
https://github.com/netfun2000/hipudding-teslamate.git
synced 2026-02-27 09:44:28 +08:00
This reverts commit b65b3f3992.
This commit is contained in:
70
.github/actions/build/action.yaml
vendored
70
.github/actions/build/action.yaml
vendored
@@ -1,70 +0,0 @@
|
||||
name: "Build"
|
||||
description: "Build images"
|
||||
inputs:
|
||||
docker_password:
|
||||
description: "Docker password"
|
||||
required: true
|
||||
repository_owner:
|
||||
description: "Repository owner"
|
||||
required: true
|
||||
default: "teslamate-org"
|
||||
repository:
|
||||
description: "Repo owner and name (repo_owner/repo_name)"
|
||||
required: true
|
||||
default: "teslamate"
|
||||
github_token:
|
||||
description: "GitHub Token"
|
||||
required: true
|
||||
labels:
|
||||
description: "Labels added on metadata"
|
||||
required: false
|
||||
default: ""
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_IMAGE }}
|
||||
labels: |
|
||||
{{ inputs.labels }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Docker Hub
|
||||
if: inputs.docker_password != ''
|
||||
uses: docker/login-action@v3.0.0
|
||||
with:
|
||||
username: teslamate
|
||||
password: ${{ inputs.docker_password }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3.0.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ inputs.repository_owner }}
|
||||
password: ${{ inputs.github_token }}
|
||||
- name: Build and push by digest
|
||||
id: build
|
||||
uses: docker/build-push-action@v5.0.0
|
||||
with:
|
||||
context: .
|
||||
platforms: ${{ matrix.platform }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
cache-from: type=registry,ref=ghcr.io/${{ inputs.repository }}:buildcache-${{ matrix.cache_id }}
|
||||
cache-to: type=registry,ref=ghcr.io/${{ inputs.repository }}:buildcache-${{ matrix.cache_id }},mode=max
|
||||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||
- name: Export digest
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p /tmp/digests
|
||||
digest="${{ steps.build.outputs.digest }}"
|
||||
touch "/tmp/digests/${digest#sha256:}"
|
||||
ls -l /tmp/digests/
|
||||
- name: Upload digest
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: digests
|
||||
path: /tmp/digests/*
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
37
.github/actions/grafana/action.yml
vendored
37
.github/actions/grafana/action.yml
vendored
@@ -1,37 +0,0 @@
|
||||
name: "Grafana"
|
||||
description: "Grafana images"
|
||||
inputs:
|
||||
tags:
|
||||
description: "Tags"
|
||||
required: false
|
||||
default: ""
|
||||
labels:
|
||||
description: "Labels"
|
||||
required: true
|
||||
image:
|
||||
description: "Image target"
|
||||
required: true
|
||||
default: "teslamate/grafana"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Docker meta
|
||||
id: docker_meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ inputs.image }}
|
||||
tags: ${{ inputs.tags }}
|
||||
labels: ${{ inputs.labels }}
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5.0.0
|
||||
with:
|
||||
context: grafana
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
40
.github/actions/merge/action.yml
vendored
40
.github/actions/merge/action.yml
vendored
@@ -1,40 +0,0 @@
|
||||
name: "Merge"
|
||||
description: "Merge images"
|
||||
inputs:
|
||||
tags:
|
||||
description: "Tags"
|
||||
required: false
|
||||
default: ""
|
||||
image:
|
||||
description: "Image target"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: digests
|
||||
path: /tmp/digests
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ inputs.image }}
|
||||
tags: ${{ inputs.tags }}
|
||||
|
||||
- name: Create manifest list and push
|
||||
working-directory: /tmp/digests
|
||||
shell: bash
|
||||
run: |
|
||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
||||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
||||
- name: Inspect image
|
||||
shell: bash
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
|
||||
108
.github/workflows/buildx.yml
vendored
108
.github/workflows/buildx.yml
vendored
@@ -31,52 +31,118 @@ jobs:
|
||||
cache_id: arm64
|
||||
|
||||
runs-on: ${{ matrix.runs_on }}
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Buildx
|
||||
uses: ./.github/actions/build
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
docker_password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
repository_owner: ${{ github.repository_owner }}
|
||||
repository: ${{ github.repository }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
images: ${{ env.REGISTRY_IMAGE }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3.0.0
|
||||
with:
|
||||
username: teslamate
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3.0.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push by digest
|
||||
id: build
|
||||
uses: docker/build-push-action@v5.0.0
|
||||
with:
|
||||
context: .
|
||||
platforms: ${{ matrix.platform }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
cache-from: type=registry,ref=ghcr.io/teslamate-org/teslamate:buildcache-${{ matrix.cache_id }}
|
||||
cache-to: type=registry,ref=ghcr.io/teslamate-org/teslamate:buildcache-${{ matrix.cache_id }},mode=max
|
||||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||
- name: Export digest
|
||||
run: |
|
||||
mkdir -p /tmp/digests
|
||||
digest="${{ steps.build.outputs.digest }}"
|
||||
touch "/tmp/digests/${digest#sha256:}"
|
||||
- name: Upload digest
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: digests
|
||||
path: /tmp/digests/*
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
teslamate_merge:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- teslamate_build
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: digests
|
||||
path: /tmp/digests
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_IMAGE }}
|
||||
tags: |
|
||||
type=schedule,pattern=edge
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=edge
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3.0.0
|
||||
with:
|
||||
username: teslamate
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Create manifest list and push
|
||||
working-directory: /tmp/digests
|
||||
run: |
|
||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
||||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
||||
- name: Inspect image
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
|
||||
|
||||
- uses: ./.github/actions/merge
|
||||
with:
|
||||
image: ${{ env.REGISTRY_IMAGE }}
|
||||
tags: |
|
||||
type=schedule,pattern=edge
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=edge
|
||||
grafana:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/grafana
|
||||
- name: Docker meta
|
||||
id: docker_meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: teslamate/grafana
|
||||
tags: |
|
||||
type=edge
|
||||
type=schedule,pattern=edge
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3.0.0
|
||||
with:
|
||||
username: teslamate
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5.0.0
|
||||
with:
|
||||
context: grafana
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
10
.github/workflows/elixir.yml
vendored
10
.github/workflows/elixir.yml
vendored
@@ -2,14 +2,8 @@ name: Elixir CI
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "**/*"
|
||||
- "!.github/**" # Important: Exclude PRs related to .github from auto-run
|
||||
pull_request:
|
||||
branches: ["master"]
|
||||
paths:
|
||||
- "**/*"
|
||||
- "!.github/**" # Important: Exclude PRs related to .github from auto-run
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
@@ -130,7 +124,7 @@ jobs:
|
||||
services:
|
||||
db:
|
||||
image: postgres:15
|
||||
ports: ["5432:5432"]
|
||||
ports: [ "5432:5432" ]
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
options: >-
|
||||
|
||||
91
.github/workflows/ghcr_build.yml
vendored
91
.github/workflows/ghcr_build.yml
vendored
@@ -1,91 +0,0 @@
|
||||
name: Build GHCR images
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- "**/*"
|
||||
- "!.github/**"
|
||||
pull_request_target:
|
||||
branches: ["master"]
|
||||
paths:
|
||||
- "**/*"
|
||||
- "!.github/**" # Important: Exclude PRs related to .github from auto-run
|
||||
|
||||
env:
|
||||
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
teslamate_build:
|
||||
name: Build images
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: "linux/amd64"
|
||||
runs_on: "ubuntu-latest"
|
||||
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:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- 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 }}
|
||||
labels: |
|
||||
org.opencontainers.image.version=${{ github.ref || github.ref_name }}
|
||||
|
||||
teslamate_merge:
|
||||
name: Merge GHCR images
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- teslamate_build
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3.0.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:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3.0.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 }}
|
||||
35
.github/workflows/ghcr_purge.yml
vendored
35
.github/workflows/ghcr_purge.yml
vendored
@@ -1,35 +0,0 @@
|
||||
name: Purge PR images
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- closed
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
purge-pr-untagged:
|
||||
name: Delete untagged images from ghcr.io
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/delete-package-versions@v4
|
||||
with:
|
||||
package-name: "teslamate"
|
||||
package-type: "container"
|
||||
min-versions-to-keep: 0
|
||||
delete-only-untagged-versions: "true"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
purge-pr-package:
|
||||
name: Delete image from ghcr.io
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: chipkent/action-cleanup-package@v1.0.1
|
||||
with:
|
||||
package-name: ${{ github.event.repository.name }}
|
||||
tag: pr-${{ github.event.pull_request.number }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -106,7 +106,7 @@
|
||||
{
|
||||
"targetBlank": false,
|
||||
"title": "View charge details",
|
||||
"url": "d/BHhxFeZRz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric:raw}"
|
||||
"url": "d/BHhxFeZRz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -302,7 +302,7 @@
|
||||
{
|
||||
"targetBlank": false,
|
||||
"title": "Set Cost",
|
||||
"url": "[[base_url:raw]]/charge-cost/${__data.fields.id.numeric:raw}"
|
||||
"url": "[[base_url:raw]]/charge-cost/${__data.fields.id.numeric}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -389,7 +389,7 @@
|
||||
{
|
||||
"targetBlank": true,
|
||||
"title": "Create or edit geo-fence",
|
||||
"url": "[[base_url:raw]]/geo-fences/${__data.fields.path:raw}"
|
||||
"url": "[[base_url:raw]]/geo-fences/${__data.fields.path}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -969,7 +969,7 @@
|
||||
{
|
||||
"targetBlank": true,
|
||||
"title": "",
|
||||
"url": "[[base_url:raw]]/geo-fences/${__data.fields.id.numeric:raw}/edit"
|
||||
"url": "[[base_url:raw]]/geo-fences/${__data.fields.id.numeric}/edit"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1637,7 +1637,7 @@
|
||||
{
|
||||
"targetBlank": false,
|
||||
"title": "View charge details",
|
||||
"url": "d/BHhxFeZRz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric:raw}"
|
||||
"url": "d/BHhxFeZRz?from=${__data.fields.start_date_ts.numeric}&to=${__data.fields.end_date_ts.numeric}&var-car_id=${__data.fields.car_id.numeric}&var-charging_process_id=${__data.fields.id.numeric}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1782,7 +1782,7 @@
|
||||
{
|
||||
"targetBlank": false,
|
||||
"title": "Set Cost",
|
||||
"url": "[[base_url:raw]]/charge-cost/${__data.fields.id.numeric:raw}"
|
||||
"url": "[[base_url:raw]]/charge-cost/${__data.fields.id.numeric}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user