Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save henningms/ae6f0b4018e1c88488bbbaf9d79fe411 to your computer and use it in GitHub Desktop.
Save henningms/ae6f0b4018e1c88488bbbaf9d79fe411 to your computer and use it in GitHub Desktop.
Set ApplicationVersion for a .NET MAUI project in Github Actions to Github Run Number
- name: Bump ApplicationVersion (build version)
env:
CSPROJ_FILE: yourproject/yourproject.csproj
NEW_VERSION: ${{ github.run_number }}
run: |
echo 'Setting ApplicationVersion (build version) to ${{ env.NEW_VERSION }}'
sed -rn 's|(<ApplicationVersion>)(.*)(</ApplicationVersion>)|Old: \1\2\3|p' ${{ env.CSPROJ_FILE }}
sed -rE -i 'notneeded.bak' 's|(<ApplicationVersion>)(.*)(</ApplicationVersion>)|<ApplicationVersion>${{ env.NEW_VERSION }}</ApplicationVersion>|g' ${{ env.CSPROJ_FILE }}
sed -rn 's|(<ApplicationVersion>)(.*)(</ApplicationVersion>)|New: \1\2\3|p' ${{ env.CSPROJ_FILE }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment