-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (79 loc) · 3.61 KB
/
xamarin-ui-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Build-Sample-APK
on:
workflow_call:
inputs:
app-version:
required: true
type: string
configuration:
required: true
type: string
jobs:
build:
name: Build Sample APK
runs-on: [self-hosted, xamarin-android]
steps:
- name: Clean Workspace
uses: mickem/clean-after-action@v1
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Get ZG APK -keystore
run: aws s3 cp s3://backup-zerogachis/github-actions/zg.keystore zg.keystore
- name: Modify AssemblyInfo files
uses: mingjun97/file-regex-replace@v1
with:
regex: 'AssemblyVersion\("(.*?)"\)'
replacement: 'AssemblyVersion("${{ inputs.app-version }}")'
include: 'AssemblyInfo.cs'
- name: Nuget - Restore packages
run: nuget restore Smartway.UiComponent.sln
- name: MsBuild - Compile
run: msbuild Smartway.UiComponent.sln -p:Configuration=${{ inputs.configuration }} -clp:Summary
- name: Unit tests
id: unittests
continue-on-error: true
run: dotnet test Smartway.UiComponent.UnitTests/Smartway.UiComponent.UnitTests.csproj --logger "trx;LogFileName=test-results-unittests.trx"
- name: Test Report - Unit Tests
uses: dorny/[email protected]
if: success() || (failure() && steps.unittests.outcome == 'failure')
with:
name: Unit Tests Results
path: 'Smartway.UiComponent.UnitTests/TestResults/test-results-unittests.trx'
reporter: dotnet-trx
- name: Build APK
run: msbuild Smartway.UiComponent.Sample.Android/Smartway.UiComponent.Sample.Android.csproj -p:Configuration=${{ inputs.configuration }} -t:PackageForAndroid
- name: Optimize APK
run: zipalign -f -v 4 Smartway.UiComponent.Sample.Android/bin/Release/com.companyname.smartway.uicomponent.sample.apk Smartway.UiComponent.Sample.Android/bin/Release/xamarin-ui-sample.apk
- name: Sign APK
run: /usr/lib/android-sdk/build-tools/30.0.3/apksigner sign --ks zg.keystore --ks-pass pass:'${{ secrets.APK_KEYSTORE_PASSWORD }}' --ks-key-alias zg_key_store Smartway.UiComponent.Sample.Android/bin/Release/xamarin-ui-sample.apk
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Xamarin-UI-${{ inputs.app-version }}
path: Smartway.UiComponent.Sample.Android/bin/Release/xamarin-ui-sample.apk
- name: Send Slack Notification
if: ${{ failure() }}
uses: slackapi/[email protected]
with:
payload: |
{
"text": "GitHub Action build result: ${{ github.workflow }} : ${{ job.status }}\nPipeline: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: ${{ github.workflow }} : ${{ job.status }}\nPipeline: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{github.run_id }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_HOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK