Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 2.3 KB

README.md

File metadata and controls

53 lines (36 loc) · 2.3 KB

AssemblyInfo Update

set-version

This Github action updates AssemblyInfo.cs files in .NET projects with the specified version number, suffixed with github.run_number.

The version number is expected to be in SemVer format with at least the major and minor version numbers, e.g. 1.20, 2.17.4, 1.4.9-alpha. Any pre-release/metadata suffix will be discarded and github.run_number appended to produce a 3- or 4-element version number.

Note that any existing value in the file is overwritten, so may be left at, say, "0.0.0.0". The updated file is not committed back to the repository.

This action is useful for automatically updating the assembly info version of a project prior to building it, for example, where the version number should be set to the latest tag.

Input arguments

  • version (required): The assembly version in semver format
  • directory: the directory where the assembly info file is located (or the top-most directory to search if recursive is true). Defaults to '.\'
  • filename: the file name of the assembly info file. Defaults to 'AssemblyInfo.cs'
  • recursive: if true, updates all assembly info files matching the filename argument, in all subdirectories. Defaults to true

Output arguments

  • version: the value of the version used in the assembly info

Example Usage

Minimal example

- name: Set version in all AssemblyInfo.cs files
  uses: secondbounce/assemblyinfo-update@v2
  with:
    version: '1.0.8'

Complete example

- name: Set version in .\Properties\SharedAssemblyInfo.cs
  id: set-assembly-version
  uses: secondbounce/assemblyinfo-update@v2
  with:
    version: '2.1.16-alpha'
    directory: '.\Properties'
    filename: 'SharedAssemblyInfo.cs'
    recursive: false

- name: Display the version used
  run: echo "{{steps.set-assembly-version.outputs.version}}"

Development Testing

This repo includes a test workflow - .github/workflows/test-actions.yml - that is configured to run on each commit to the develop (and main) branch. This workflow runs the latest code as a test, saving the updated sample files as artifacts, should the output need to be checked.