Skip to content

Commit

Permalink
Add windows build in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry08 committed Nov 26, 2023
1 parent e637423 commit 55a4e04
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ env:
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry

jobs:
# MAUI Android Build
build-android:
# MAUI Build
build:
runs-on: windows-latest

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

name: Android Build
name: Build & Upload Artifacts
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -57,17 +57,38 @@ jobs:
mv Anikin/bin/Release/net8.0-android/com.oneb.anikin-Signed.apk Anikin.apk
shell: bash

# Move the file with windows cmd https://stackoverflow.com/a/7268357
- name: Move apk file
run: |
if not exist build md build
move Anikin.apk build/Anikin.apk
- name: Publish MAUI Windows (x64)
run: >
dotnet publish Anikin/
-c Release
-f net8.0-windows10.0.19041.0
-p:RuntimeIdentifierOverride=win10-x64
-p:WindowsPackageType=None
-o build/windows
/p:CSharpier_Bypass=true
- name: Create windows package
run: powershell Compress-Archive build/windows 'Anikin (windows).zip'

- name: Upload Android Artifact
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Anikin
path: Anikin.apk
path: build/

deploy:
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
needs: build-android

needs: build
runs-on: ubuntu-latest

permissions:
actions: read
contents: write
Expand All @@ -83,7 +104,7 @@ jobs:
echo $TAG_NAME
VERSION="$(echo $TAG_NAME | tr -d v)"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "PACKAGE_NAME=${{ github.event.repository.name }}-$TAG_NAME.apk" >> $GITHUB_ENV
echo "PACKAGE_NAME=${{ github.event.repository.name }}-$TAG_NAME" >> $GITHUB_ENV
Prerelease_Param=""
if [[ $TAG_NAME == *"-pre"* || $TAG_NAME == *"-beta"* || $TAG_NAME == *"-alpha"* ]]; then
Prerelease_Param="--prerelease"
Expand All @@ -95,7 +116,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: Anikin
path: Anikin
path: build

- name: Set body
run: |
Expand All @@ -109,14 +130,15 @@ jobs:
run: |
set -e
mv Anikin/Anikin.apk ${{ env.PACKAGE_NAME }}
mv build/Anikin.apk ${{ env.PACKAGE_NAME }}.apk
mv 'build/Anikin (windows).zip' '${{ env.PACKAGE_NAME }} (windows).zip'
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release create "${{ github.ref_name }}"
"${{ env.PACKAGE_NAME }}"
"${{ env.PACKAGE_NAME }}.apk"
--repo "${{ github.event.repository.full_name }}"
--title "${{ env.VERSION }}"
--notes "${{ env.TAG_MESSAGE2 }}"
Expand Down Expand Up @@ -147,7 +169,7 @@ jobs:
run: |
TAG_NAME="${{ github.ref_name }}"
echo "$TAG_NAME"
echo "PACKAGE_NAME=${{ github.event.repository.name }}-$TAG_NAME.apk" >> $GITHUB_ENV
echo "PACKAGE_NAME=${{ github.event.repository.name }}-$TAG_NAME" >> $GITHUB_ENV
- name: Set variables 2
run: |
Expand All @@ -174,5 +196,5 @@ jobs:
{
"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.repository.html_url }}/releases/download/${{ github.ref_name }}/${{ env.PACKAGE_NAME }}>"
"content": "**${{ github.event.repository.name }}** new version released!\nVersion: `${{ github.ref_name }}`\n\n${{ env.RELEASE_BODY }}\n\nDownload: <${{ github.event.repository.html_url }}/releases/download/${{ github.ref_name }}/${{ env.PACKAGE_NAME }}.apk>"
}

0 comments on commit 55a4e04

Please sign in to comment.