fix: dispath docker arch #10
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
name: "Build/Push Image to Docker Hub" | ||
on: | ||
workflow_run: | ||
workflows: ["semantic_release"] | ||
types: | ||
- completed | ||
jobs: | ||
informations: | ||
runs-on: [ ubuntu-latest ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Discord notification building state | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
uses: Ilshidur/action-discord@master | ||
with: | ||
args: '**MyElectricalData** : Version **${{ needs.informations.outputs.version }}** is in building state...' | ||
- name: Get version | ||
id: informations | ||
run: | | ||
version=$(cat src/main.py |grep VERSION| awk '{print $3}' | tr -d '"') | ||
echo "version=${version}" >> "$GITHUB_OUTPUT" | ||
release_type=$(cat src/main.py |grep VERSION| awk '{print $3}' | tr -d '"'| grep rc) | ||
if [ "$release_type" == "" ]; then | ||
# RELEASE | ||
echo "release_type=release" >> "$GITHUB_OUTPUT" | ||
else | ||
# PRERELEASE | ||
echo "release_type=prerelease" >> "$GITHUB_OUTPUT" | ||
fi | ||
outputs: | ||
version: ${{ steps.informations.outputs.version }} | ||
release_type: ${{ steps.informations.outputs.release_type }} | ||
################################################################################################################# | ||
# BUILD & PUSH IMAGE | ||
Build-And-Push-Image-AMD64: | ||
needs: [informations] | ||
name: Build & Deploy in docker.io | ||
runs-on: [ ubuntu-latest ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
################################################################################################################# | ||
# SETUP DOCKER | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
################################################################################################################# | ||
# VERSION | ||
- name: Build and push ${{ needs.informations.outputs.version }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: Dockerfile | ||
platforms: linux/amd64 | ||
context: . | ||
push: true | ||
tags: | | ||
m4dm4rtig4n/enedisgateway2mqtt:${{ needs.informations.outputs.version }} | ||
m4dm4rtig4n/enedisgateway2mqtt:latest-dev | ||
m4dm4rtig4n/myelectricaldata:${{ needs.informations.outputs.version }} | ||
m4dm4rtig4n/myelectricaldata:latest-dev | ||
# ################################################################################################################## | ||
# # LATEST | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
if: ${{ needs.informations.outputs.release_type }} == "release" | ||
with: | ||
file: Dockerfile | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
tags: | | ||
m4dm4rtig4n/enedisgateway2mqtt:latest | ||
m4dm4rtig4n/myelectricaldata:latest | ||
- name: Discord notification ${{ needs.informations.outputs.version }} image version is up to date | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
uses: Ilshidur/action-discord@master | ||
with: | ||
args: '**MyElectricalData** : **${{ needs.informations.outputs.version }}**/latest AMD64 image version is up to date' | ||
Build-And-Push-Image-ARM64: | ||
needs: [informations] | ||
name: Build & Deploy in docker.io | ||
runs-on: [ ubuntu-latest ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
################################################################################################################# | ||
# SETUP DOCKER | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
################################################################################################################# | ||
# VERSION | ||
- name: Build and push ${{ needs.informations.outputs.version }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: Dockerfile | ||
platforms: linux/arm64 | ||
context: . | ||
push: true | ||
tags: | | ||
m4dm4rtig4n/enedisgateway2mqtt:${{ needs.informations.outputs.version }} | ||
m4dm4rtig4n/enedisgateway2mqtt:latest-dev | ||
m4dm4rtig4n/myelectricaldata:${{ needs.informations.outputs.version }} | ||
m4dm4rtig4n/myelectricaldata:latest-dev | ||
# ################################################################################################################## | ||
# # LATEST | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
if: ${{ needs.informations.outputs.release_type }} == "release" | ||
with: | ||
file: Dockerfile | ||
context: . | ||
platforms: linux/arm64 | ||
push: true | ||
tags: | | ||
m4dm4rtig4n/enedisgateway2mqtt:latest | ||
m4dm4rtig4n/myelectricaldata:latest | ||
- name: Discord notification ${{ needs.informations.outputs.version }} image version is up to date | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
uses: Ilshidur/action-discord@master | ||
with: | ||
args: '**MyElectricalData** : **${{ needs.informations.outputs.version }}**/latest ARM64 image version is up to date' | ||
Build-And-Push-Image-ARMv6: | ||
needs: [informations] | ||
name: Build & Deploy in docker.io | ||
runs-on: [ ubuntu-latest ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
################################################################################################################# | ||
# SETUP DOCKER | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
################################################################################################################# | ||
# VERSION | ||
- name: Build and push ${{ needs.informations.outputs.version }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: Dockerfile | ||
platforms: linux/arm/v6 | ||
context: . | ||
push: true | ||
tags: | | ||
m4dm4rtig4n/enedisgateway2mqtt:${{ needs.informations.outputs.version }} | ||
m4dm4rtig4n/enedisgateway2mqtt:latest-dev | ||
m4dm4rtig4n/myelectricaldata:${{ needs.informations.outputs.version }} | ||
m4dm4rtig4n/myelectricaldata:latest-dev | ||
# ################################################################################################################## | ||
# # LATEST | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
if: ${{ needs.informations.outputs.release_type }} == "release" | ||
with: | ||
file: Dockerfile | ||
context: . | ||
platforms: linux/arm/v6 | ||
push: true | ||
tags: | | ||
m4dm4rtig4n/enedisgateway2mqtt:latest | ||
m4dm4rtig4n/myelectricaldata:latest | ||
- name: Discord notification ${{ needs.informations.outputs.version }} image version is up to date | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
uses: Ilshidur/action-discord@master | ||
with: | ||
args: '**MyElectricalData** : **${{ needs.informations.outputs.version }}**/latest ARMv6 image version is up to date' | ||
Build-And-Push-Image-ARMv7: | ||
needs: [informations] | ||
name: Build & Deploy in docker.io | ||
runs-on: [ ubuntu-latest ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
################################################################################################################# | ||
# SETUP DOCKER | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
################################################################################################################# | ||
# VERSION | ||
- name: Build and push ${{ needs.informations.outputs.version }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: Dockerfile | ||
platforms: linux/arm/v7 | ||
context: . | ||
push: true | ||
tags: | | ||
m4dm4rtig4n/enedisgateway2mqtt:${{ needs.informations.outputs.version }} | ||
m4dm4rtig4n/enedisgateway2mqtt:latest-dev | ||
m4dm4rtig4n/myelectricaldata:${{ needs.informations.outputs.version }} | ||
m4dm4rtig4n/myelectricaldata:latest-dev | ||
# ################################################################################################################## | ||
# # LATEST | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
if: ${{ needs.informations.outputs.release_type }} == "release" | ||
with: | ||
file: Dockerfile | ||
context: . | ||
platforms: linux/arm/v7 | ||
push: true | ||
tags: | | ||
m4dm4rtig4n/enedisgateway2mqtt:latest | ||
m4dm4rtig4n/myelectricaldata:latest | ||
- name: Discord notification ${{ needs.informations.outputs.version }} image version is up to date | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
uses: Ilshidur/action-discord@master | ||
with: | ||
args: '**MyElectricalData** : **${{ needs.informations.outputs.version }}**/latest ARMv7 image version is up to date' | ||
Finish: | ||
runs-on: [ ubuntu-latest ] | ||
steps: | ||
- name: Discord notification | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
uses: Ilshidur/action-discord@master | ||
with: | ||
args: '**MyElectricalData** : New version available **${{ needs.informations.outputs.version }}**' |