Publish Docker images #1578
This file contains hidden or 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
| name: Publish Docker images | |
| on: | |
| workflow_call: | |
| schedule: | |
| - cron: "0 3 * * *" | |
| push: | |
| tags: | |
| - "v*" | |
| 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 | |
| # Pull requests touching .github are excluded from the automatic runs above, | |
| # since the workflow definition that would run is the one from the pull | |
| # request. This is the deliberate way to build them anyway, by someone with | |
| # write access. The job conditions below allow for it. Note that this | |
| # publishes: a run from a branch overwrites the edge tag. | |
| workflow_dispatch: | |
| env: | |
| REGISTRY_IMAGE: teslamate/teslamate | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| artifact-metadata: write | |
| jobs: | |
| check_paths: | |
| uses: ./.github/workflows/check_paths.yml | |
| teslamate_build: | |
| needs: check_paths | |
| if: needs.check_paths.outputs.githubfolder == 'false' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: "linux/amd64" | |
| runs_on: "ubuntu-24.04" | |
| cache_id: amd64 | |
| - platform: "linux/arm64" | |
| runs_on: "ubuntu-24.04-arm" | |
| cache_id: arm64 | |
| runs-on: ${{ matrix.runs_on }} | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Buildx | |
| uses: ./.github/actions/build | |
| with: | |
| is_dockerhub_pushed: "1" | |
| docker_password: ${{ secrets.DOCKER_PASSWORD }} | |
| repository_owner: ${{ github.repository_owner }} | |
| repository: ${{ github.repository }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| version: ${{ github.head_ref || github.ref_name }} | |
| teslamate_merge: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - check_paths | |
| - teslamate_build | |
| if: needs.check_paths.outputs.githubfolder == 'false' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 | |
| with: | |
| username: teslamate | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - 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: | |
| needs: check_paths | |
| if: needs.check_paths.outputs.githubfolder == 'false' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 | |
| with: | |
| username: teslamate | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - uses: ./.github/actions/grafana | |
| with: | |
| tags: | | |
| type=edge | |
| type=schedule,pattern=edge | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} |