Switch to custom discord notification and rename ci-build.yml to main… #1
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: main | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.gitignore' | |
- '**/*.gitattributes' | |
pull_request: | |
branches: [ master ] | |
release: | |
types: [published] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
DOTNET_NOLOGO: true # Disable the .NET logo | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience | |
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry | |
jobs: | |
# MAUI Android Build | |
build-android: | |
runs-on: windows-latest | |
name: Android Build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 7.0.x | |
- name: Install MAUI Workload | |
run: dotnet workload install maui --ignore-failed-sources | |
- name: Restore Dependencies | |
run: dotnet restore Yosu/Yosu.csproj | |
- name: Build MAUI Android | |
run: dotnet publish Yosu/Yosu.csproj -c Release -f net7.0-android -p:AndroidKeyStore=false | |
- name: Upload Android Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: yosu-android-ci-build | |
path: Yosu/bin/Release/net7.0-android/*Signed.a* | |
notify: | |
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} | |
needs: build-android | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Set Release Notes | |
run: | | |
content=${{ toJSON(github.event.release.body) }} | |
# The following lines are required for multiline json | |
content="${content//'%'/'%25'}" | |
content="${content//$'\n'/'%0A'}" | |
content="${content//$'\r'/'%0D'}" | |
echo "RELEASE_BODY $content" | |
echo "RELEASE_BODY=$content" >> $GITHUB_ENV | |
- name: Notify Discord | |
uses: tyrrrz/action-http-request@v1 | |
with: | |
url: ${{ secrets.DISCORD_WEBHOOK }} | |
method: POST | |
headers: | | |
Content-Type: application/json; charset=UTF-8 | |
body: | | |
{ | |
"username": "Notifications", | |
"avatar_url": "https://raw.githubusercontent.com/${{ github.event.repository.full_name }}/master/favicon.png", | |
"content": "**${{ github.event.repository.name }}** new version released!\nVersion: `${{ github.ref_name }}`\n\n${{ env.RELEASE_BODY }}\n\nDownload: <${{ github.event.release.assets[0].browser_download_url }}>" | |
} |