Skip to content

Commit

Permalink
Merge pull request #39 from pkuehnel/develop
Browse files Browse the repository at this point in the history
Feat/cicd (#34)
  • Loading branch information
pkuehnel authored Mar 14, 2022
2 parents 39a1fb3 + 78ab012 commit c9ec735
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
file: ./SmartTeslaAmpSetter/Server/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: pkuehnel/smartteslaampsetter:latest
tags: pkuehnel/smartteslaampsetter:edge

SmaEnergymeterplugin:
name: Building SMAPlugin Image
Expand All @@ -57,4 +57,4 @@ jobs:
file: ./Plugins.SmaEnergymeter/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: pkuehnel/smartteslaampsettersmaplugin:latest
tags: pkuehnel/smartteslaampsettersmaplugin:edge
140 changes: 140 additions & 0 deletions .github/workflows/versionRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: versionRelease
on:
release:
types: [published]

jobs:
releaseFiles:
name: Release
strategy:
matrix:
kind: ['linux-x64', 'linux-arm64']
include:
- kind: linux-x64
os: ubuntu-latest
target: linux-x64
- kind: linux-arm64
os: ubuntu-latest
target: linux-arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

- name: Build SmartTeslaAmpSetter
shell: bash
run: |
# Define some variables for things we need
tag=$(git describe --tags --abbrev=0)
release_name="SmartTeslaAmpSetter-$tag-${{ matrix.target }}"
# Build everything
dotnet publish SmartTeslaAmpSetter/Server/SmartTeslaAmpSetter.Server.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name"
# Pack files
tar czvf "${release_name}.tar.gz" "$release_name"
# Delete output directory
rm -r "$release_name"
- name: Build Plugins.SmaEnergymeter
shell: bash
run: |
# Define some variables for things we need
tag=$(git describe --tags --abbrev=0)
release_name="Plugins.SmaEnergymeter-$tag-${{ matrix.target }}"
# Build everything
dotnet publish Plugins.SmaEnergymeter/Plugins.SmaEnergymeter.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name"
# Pack files
tar czvf "${release_name}.tar.gz" "$release_name"
# Delete output directory
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "*.tar.gz"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

releaseDockerLatestSmartTeslaAmpSetter:
name: Building SmartTeslaAmpSetter image
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
pkuehnel/smartteslaampsetter
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
- name: Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: DockerHub login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS}}

- name: Build and push SmartTeslaAmpSetter
uses: docker/build-push-action@v2
with:
file: ./SmartTeslaAmpSetter/Server/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}

releaseDockerLatestSmaEnergymeterplugin:
name: Building SMAPlugin Image
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
pkuehnel/smartteslaampsettersmaplugin
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
- name: Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: DockerHub login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS}}

- name: Build and push SmaPlugin
uses: docker/build-push-action@v2
with:
file: ./Plugins.SmaEnergymeter/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
12 changes: 12 additions & 0 deletions SmartTeslaAmpSetter/Server/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "6.0.3",
"commands": [
"dotnet-ef"
]
}
}
}

0 comments on commit c9ec735

Please sign in to comment.