Skip to content

Merge branch 'dotnet8' #21

Merge branch 'dotnet8'

Merge branch 'dotnet8' #21

Workflow file for this run

name: Main Workflow
on:
push:
branches:
- main
workflow_dispatch:
inputs:
tag:
description: container image tag
default: dev
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.number }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
- name: Build Project
run: dotnet build -c Release -o output Redfin
- name: Test Project
run: dotnet test --collect:"XPlat Code Coverage" RedfinTest
- name: Obtain Version
id: version
run: echo "number=$(./output/Redfin -- version)" >> $GITHUB_OUTPUT
- name: Upload coverage
run: bash <(curl -s https://codecov.io/bash)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
containerize:
name: Upload Docker Images
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Context for Buildx
id: buildx-context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: builders
- name: Setup Build Version
id: build_version
run: |
BUILD_VERSION="${{ needs.build.outputs.version }}"
echo "number=${BUILD_VERSION:1}" >> $GITHUB_OUTPUT
- name: Build and Push (Dev)
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v3
with:
push: true
platforms: "linux/amd64,linux/arm64,linux/arm/v7"
build-args: |
BUILD_VERSION=${{ steps.build_version.outputs.number }}
tags: "mannkind/redfin2mqtt:dev"
- name: Build and Push (Main)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v3
with:
push: true
platforms: "linux/amd64,linux/arm64,linux/arm/v7"
build-args: |
BUILD_VERSION=${{ steps.build_version.outputs.number }}
tags: "mannkind/redfin2mqtt:latest,mannkind/redfin2mqtt:${{ needs.build.outputs.version }},ghcr.io/mannkind/redfin2mqtt:latest,ghcr.io/mannkind/redfin2mqtt:${{ needs.build.outputs.version }}"
release:
name: Release
runs-on: ubuntu-latest
needs: [build, containerize]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Tag Revision
run: |
git tag -f ${{ needs.build.outputs.version }}
- name: Push Release
run: |
git push --tags