Skip to content

Commit 55febdf

Browse files
committed
readme
1 parent 709d6ee commit 55febdf

4 files changed

Lines changed: 81 additions & 8 deletions

File tree

.github/workflows/main.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,43 @@ jobs:
4242
with:
4343
csproj: tests/MauiApp.csproj
4444
version: ${{ github.run_number }}
45-
displayVersion: '100.500'
45+
displayVersion: '100.500'
46+
47+
action-test-ubuntu-diaplay:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v3
51+
- name: MAUIAppVersion
52+
uses: managedcode/MAUIAppVersion@v0.0.5-alpha
53+
with:
54+
csproj: tests/MauiApp.csproj
55+
displayVersion: '100.500'
56+
57+
action-test-ubuntu-version:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/checkout@v3
61+
- name: MAUIAppVersion
62+
uses: managedcode/MAUIAppVersion@v0.0.5-alpha
63+
with:
64+
csproj: tests/MauiApp.csproj
65+
version: ${{ github.run_number }}
66+
67+
action-test-ubuntu-none:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v3
71+
- name: MAUIAppVersion
72+
uses: managedcode/MAUIAppVersion@v0.0.5-alpha
73+
with:
74+
csproj: tests/MauiApp.csproj
75+
76+
action-test-ubuntu-none:
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v3
80+
- name: MAUIAppVersion
81+
uses: managedcode/MAUIAppVersion@v0.0.5-alpha
82+
with:
83+
csproj: tests/MauiApp.csproj
84+
printFile: false

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
# BumpMAUIAppVersion
1+
# Update MAUI App Version Action
2+
3+
This action updates the application version and/or display version properties in a .cproj file for a MAUI application. You can use this action as part of your CI/CD workflow to automatically update the version properties when building and publishing your MAUI application.
4+
5+
## Inputs
6+
7+
### `csproj` (required)
8+
9+
The path to the .cproj file for your MAUI application.
10+
11+
### `version`
12+
13+
The new value to set for the `ApplicationVersion` property in the .cproj file. If this input is not provided, the `ApplicationVersion` property will not be updated.
14+
15+
### `displayVersion`
16+
17+
The new value to set for the `ApplicationDisplayVersion` property in the .cproj file. If this input is not provided, the `ApplicationDisplayVersion` property will not be updated.
18+
19+
### `printFile`
20+
21+
Whether to print the contents of the updated .cproj file to the console. Set to `true` to print the contents of the file, or leave blank to not print the file contents.
22+
23+
24+
## Example usage
25+
26+
```yaml
27+
uses: managedcode/MAUIAppVersion@v1
28+
with:
29+
csproj: 'path/to/my-project.csproj'
30+
version: ${{ github.run_number }} # to keep value unique
31+
displayVersion: '1.0.0'
32+
printFile: true # optional
33+
```
34+
35+
This example updates the `ApplicationVersion` property to `128` and the `ApplicationDisplayVersion` property to `1.0.0` in the .cproj file located at `path/to/my-project.csproj`. The contents of the updated .cproj file will be printed to the console.

action.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ inputs:
44
csproj:
55
description: 'Path to csproj file'
66
required: true
7-
default: '1'
87
version:
98
description: 'Value for ApplicationVersion property'
109
required: false
@@ -16,10 +15,8 @@ inputs:
1615
printFile:
1716
description: 'Print file content'
1817
required: false
19-
default: true
20-
#outputs:
21-
# time: # id of output
22-
# description: 'The time we greeted you'
18+
default: false
19+
2320
runs:
2421
using: 'node16'
2522
main: 'index.js'

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ try {
1515
core.setFailed("Paramenter csproj is required.");
1616
}
1717

18-
1918
// match <ApplicationVersion> followed by any sequence of characters that are not a '<', followed by </ApplicationVersion>
2019
const applicationVersionPattern = /<ApplicationVersion>[^<]*<\/ApplicationVersion>/g;
2120
const applicationDisplayVersionPattern = /<ApplicationDisplayVersion>[^<]*<\/ApplicationDisplayVersion>/g;
@@ -26,6 +25,8 @@ try {
2625
var updatedApplicationVersion = fileContents.replace(applicationVersionPattern, `<ApplicationVersion>${version}</ApplicationVersion>`);
2726
// Write the updated contents back to the file
2827
fs.writeFileSync(csproj, updatedApplicationVersion, 'utf8');
28+
29+
console.log(`<ApplicationVersion>${version}</ApplicationVersion>`);
2930
}
3031

3132
if (displayVersion && displayVersion.trim() !== '') {
@@ -34,6 +35,8 @@ try {
3435
var updatedApplicationVersion = fileContents.replace(applicationDisplayVersionPattern, `<ApplicationDisplayVersion>${displayVersion}</ApplicationDisplayVersion>`);
3536
// Write the updated contents back to the file
3637
fs.writeFileSync(csproj, updatedApplicationVersion, 'utf8');
38+
39+
console.log(`<ApplicationDisplayVersion>${displayVersion}</ApplicationDisplayVersion>`);
3740
}
3841

3942
if(printFile) {

0 commit comments

Comments
 (0)