Skip to content

Commit

Permalink
Merge pull request #30 from exendahal/fix/upload_artifact_on_tag
Browse files Browse the repository at this point in the history
Update ci file to create apk
  • Loading branch information
exendahal authored Aug 5, 2024
2 parents b1791ad + c82e584 commit 271c99a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 37 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/basic-ci.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build .NET MAUI Project

# Trigger the workflow on manual dispatch, push to develop branch, pull request to develop branch, and new tag creation
on:
workflow_dispatch:
push:
branches: [ "develop" ]
paths-ignore:
- "**.md"
pull_request:
branches: [ "develop" ]
create:
tags:
- '*'

# Environment variables for build configuration
env:
BUILD_CONFIGURATION: Release
DOTNET_VERSION: 8.0.x
CSPROJ_TO_BUILD: EcommerceMAUI.csproj

jobs:
build-ci:
runs-on: windows-latest

steps:
# Checkout the repository
- uses: actions/checkout@v3

# Setup the specified .NET version
- name: Setup .NET ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

# Install the .NET MAUI workload
- name: Install .NET MAUI Workload
run: dotnet workload install maui

# Restore project dependencies
- name: Restore dependencies
run: dotnet restore ${{ env.CSPROJ_TO_BUILD }}

# Build the project for the specified configuration and Android target framework
- name: Build ${{ env.CSPROJ_TO_BUILD }}
run: dotnet build ${{ env.CSPROJ_TO_BUILD }} -c ${{ env.BUILD_CONFIGURATION }} -f:net8.0-android

# Publish the APK to the output directory
- name: Publish APK
run: dotnet publish ${{ env.CSPROJ_TO_BUILD }} -c ${{ env.BUILD_CONFIGURATION }} -f:net8.0-android -o ./output

# Upload the APK as an artifact
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: apk
path: ./output/*.apk

0 comments on commit 271c99a

Please sign in to comment.