Check for adding existing connections #53
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 and Release dotNet | |
#on: [push] | |
on: | |
push: | |
paths-ignore: | |
- '*.md' | |
- '.github/**' | |
- '*.yaml' | |
- '*.png' | |
- 'LICENSE' | |
jobs: | |
release-project: | |
name: Release application to GitHub | |
strategy: | |
matrix: | |
kind: [ 'amd64', 'arm64', 'armv7' ] | |
include: | |
- kind: amd64 | |
target: linux-amd64 | |
release_name: "iGotify-Notification-Service-amd64" | |
- kind: arm64 | |
target: linux-arm64 | |
release_name: "iGotify-Notification-Service-arm64" | |
- kind: armv7 | |
target: linux-arm | |
release_name: "iGotify-Notification-Service-arm" | |
runs-on: ubuntu-latest | |
needs: build-project | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download Binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: ${{ matrix.release_name }} | |
- name: Archive binaries | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: thedoctor0/zip-release@master | |
with: | |
filename: ${{ matrix.release_name }}.zip | |
path: ${{ matrix.release_name }} | |
- name: Get latest Tag | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: get-latest-tag | |
- name: Get version informations | |
id: infos | |
run: | | |
versionGit=${{ steps.get-latest-tag.outputs.tag }} | |
versionProject=v$(grep '<Version>' 'iGotify Notification Assist.csproj' | cut -d '>' -f2 | cut -d '<' -f1 | xargs) | |
if [ "$versionGit" != "$versionProject" -a $(git tag | grep -c "$versionProject") -eq 0 ]; then | |
echo "version=$versionProject" >> $GITHUB_OUTPUT | |
echo "createtag=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
echo "version=$versionGit" >> $GITHUB_OUTPUT | |
echo "createtag=false" >> $GITHUB_OUTPUT | |
- name: Create GitHub Release | |
if: steps.infos.outputs.createtag == 'true' | |
id: create-new-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_RELEASE }} | |
with: | |
tag_name: ${{ steps.infos.outputs.version }} | |
release_name: Release ${{ steps.infos.outputs.version }} | |
- name: Get Release URL | |
if: startsWith(github.ref, 'refs/tags/v') | |
id: get-release-url | |
uses: jossef/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_RELEASE }} | |
- name: Upload asset to GitHub Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_RELEASE }} | |
with: | |
upload_url: ${{ steps.get-release-url.outputs.upload_url }} | |
asset_path: ./${{ matrix.release_name }}.zip | |
asset_name: ${{ matrix.release_name }}-${{ steps.infos.outputs.version }}.zip | |
asset_content_type: application/zip | |
- name: Gotify Notification SUCCESS | |
if: success() | |
uses: eikendev/gotify-action@master | |
with: | |
gotify_api_base: ${{ secrets.API_BASE }} | |
gotify_app_token: ${{ secrets.API_TOKEN }} | |
notification_title: '[RELEASE] Create & Upload' | |
notification_message: 'Release ${{ steps.infos.outputs.version }} successfully created and binaries uploaded.' | |
notification_priority: 0 | |
- name: Gotify Notification FAILED | |
if: failure() | |
uses: eikendev/gotify-action@master | |
with: | |
gotify_api_base: ${{ secrets.API_BASE }} | |
gotify_app_token: ${{ secrets.API_TOKEN }} | |
notification_title: '[RELEASE] Create & Upload' | |
notification_message: 'Release ${{ steps.infos.outputs.version }} failed and binaries not uploaded.' | |
notification_priority: 9 | |
- name: Gotify Notification CANCELLED | |
if: cancelled() | |
uses: eikendev/gotify-action@master | |
with: | |
gotify_api_base: ${{ secrets.API_BASE }} | |
gotify_app_token: ${{ secrets.API_TOKEN }} | |
notification_title: '[RELEASE] Create & Upload' | |
notification_message: 'Release ${{ steps.infos.outputs.version }} cancelled by user and binaries not uploaded.' | |
notification_priority: 5 | |
build-project: | |
#if: github.event.pull_request.merged == true | |
name: Build dotNet | |
strategy: | |
matrix: | |
dotnet-version: [ '8.x' ] | |
kind: [ 'amd64', 'arm64', 'armv7' ] | |
include: | |
- kind: amd64 | |
target: linux-amd64 | |
release_name: "iGotify-Notification-Service-amd64" | |
- kind: arm64 | |
target: linux-arm64 | |
release_name: "iGotify-Notification-Service-arm64" | |
- kind: armv7 | |
target: linux-arm | |
release_name: "iGotify-Notification-Service-arm" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup dotnet ${{ matrix.dotnet-version }} | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- name: Display dotnet version | |
run: dotnet --version | |
- name: dotNet Restore | |
run: dotnet restore "./iGotify Notification Assist.csproj" --runtime ${{ matrix.target }} | |
- name: dotNet Build | |
run: dotnet build "./iGotify Notification Assist.csproj" --runtime ${{ matrix.target }} -o "./${{ matrix.release_name }}/build" | |
- name: dotNet Publish | |
run: dotnet publish "./iGotify Notification Assist.csproj" -c Release --runtime ${{ matrix.target }} -o "./${{ matrix.release_name }}/publish" | |
# - name: Upload coverage reports to Codecov | |
# uses: codecov/[email protected] | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# slug: androidseb25/iGotify-Notification-Assistent | |
- name: Upload Binaries ${{ matrix.target }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: "./${{ matrix.release_name }}/publish" | |
- name: Gotify Notification SUCCESS | |
if: success() | |
uses: eikendev/gotify-action@master | |
with: | |
gotify_api_base: ${{ secrets.API_BASE }} | |
gotify_app_token: ${{ secrets.API_TOKEN }} | |
notification_title: '[DOTNET] Build & Upload Artifacts' | |
notification_message: 'DotNet build successfully on target: ${{ matrix.target }}.\nArtifact uploaded.' | |
notification_priority: 0 | |
- name: Gotify Notification FAILED | |
if: failure() | |
uses: eikendev/gotify-action@master | |
with: | |
gotify_api_base: ${{ secrets.API_BASE }} | |
gotify_app_token: ${{ secrets.API_TOKEN }} | |
notification_title: '[DOTNET] Build & Upload Artifacts' | |
notification_message: 'DotNet build failed on target: ${{ matrix.target }}.\nArtifact not uploaded.' | |
notification_priority: 9 | |
- name: Gotify Notification CANCELLED | |
if: cancelled() | |
uses: eikendev/gotify-action@master | |
with: | |
gotify_api_base: ${{ secrets.API_BASE }} | |
gotify_app_token: ${{ secrets.API_TOKEN }} | |
notification_title: '[DOTNET] Build & Upload Artifacts' | |
notification_message: 'DotNet build cancelled by user on target: ${{ matrix.target }}.\nArtifact not uploaded.' | |
notification_priority: 5 |