mirror of
https://github.com/tobiasehlert/teslamateapi.git
synced 2026-02-27 09:54:18 +08:00
Updating build workflow with enhancements (#131)
* adding edge docker image tag for image based on main branch * adding GHCR to container repos * updating build apiVersion during build * only doing build when certain paths are changed
This commit is contained in:
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@@ -8,6 +8,11 @@ on:
|
||||
- "bug-*"
|
||||
tags:
|
||||
- "v*"
|
||||
paths:
|
||||
- "src/**"
|
||||
- "Dockerfile"
|
||||
- "go.mod"
|
||||
- "go.sum"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -20,7 +25,13 @@ jobs:
|
||||
id: docker_meta
|
||||
uses: docker/metadata-action@v3.6.2
|
||||
with:
|
||||
images: tobiasehlert/teslamateapi
|
||||
images: |
|
||||
tobiasehlert/teslamateapi
|
||||
ghcr.io/tobiasehlert/teslamateapi
|
||||
tags: |
|
||||
type=edge
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=v{{major}}.{{minor}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1.2.0
|
||||
@@ -43,6 +54,23 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1.12.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Configure build information
|
||||
id: build_information
|
||||
run: |
|
||||
if [[ ${{ github.ref_type }} == "tag" ]]; then
|
||||
echo "::set-output name=release_name::$( echo ${{ github.ref_name }} )"
|
||||
else
|
||||
echo "::set-output name=release_name::$( echo unknown )"
|
||||
fi
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2.7.0
|
||||
with:
|
||||
@@ -55,4 +83,4 @@ jobs:
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
build-args: |
|
||||
apiVersion=${{ github.event.release.tag_name }}
|
||||
apiVersion=${{ steps.build_information.outputs.release_name }}
|
||||
|
||||
Reference in New Issue
Block a user