Skip to content

Commit

Permalink
feat: build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 1, 2021
0 parents commit 5fcb2ce
Show file tree
Hide file tree
Showing 4 changed files with 5,821 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 dolittle

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# GitHub Action - Update VersionInfo Files
This GitHub action updates version info in source files based on the provided semantic version. This can be used before building to include the build information in released binaries.

![Github JavaScript Actions CI/CD](https://github.com/dolittle/repository-here/workflows/Github%20JavaScript%20Actions%20CI/CD/badge.svg)

### Pre requisites
Create a workflow `.yml` file in your `.github/workflows` directory. An [example workflow](#example-workflow) is available below.

For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)

### Inputs
- `version` (required): Version of the release to use to replace values in the specified files.
- `files-to-update` (required): A comma or newline separated list of files to replace values in.
- `allow-multiple-replacements`: Whether or not to allow multiple replacements of each value in a file. Defaults to 'false'.
- `allow-no-replacements`: Whether or not to allow no replacements of each value in a file. Defaults to 'false'.
- `replacements`: A comma separated list of values to replace. Items can be any of (major, minor, patch, prerelease, full). Defaults to 'major, minor, patch, prerelease'.
- `major-type`: The type of literal to replace for the 'major' replacement. Can be (string, number, exact). Defaults to 'number'.
- `major-match`: The value to find for the 'major' replacement. Defaults to '377'.
- `minor-type`: The type of literal to replace for the 'minor' replacement. Can be (string, number, exact). Defaults to 'number'.
- `minor-match`: The value to find for the 'minor' replacement. Defaults to '389'.
- `patch-type`: The type of literal to replace for the 'patch' replacement. Can be (string, number, exact). Defaults to 'number'.
- `patch-match`: The value to find for the 'patch' replacement. Defaults to '368'.
- `prerelease-type`: The type of literal to replace for the 'prerelease' replacement. Can be (string, number, exact). Defaults to 'string'.
- `prerelease-match`: The value to find for the 'prerelease' replacement. Defaults to 'PRERELEASE'.
- `full-type`: The type of literal to replace for the 'full' replacement. Can be (string, number, exact). Defaults to 'string'.
- `full-match`: The value to find for the 'full' replacement. Defaults to '377.389.368-PRERELEASE'.

### Outputs
This action has no outputs.

### Example Workflow
```yaml
on:
push:
branches:
- '**'
pull_request:
types: [closed]

name: GitHub action workflow name

jobs:
context:
name: Job name
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Establish context
id: context
uses: dolittle/establish-context-action@v2
- name: Increment version
id: increment-version
uses: dolittle/increment-version-action@v2
with:
version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}
- name: Update versioninfo
uses: dolittle/update-version-info-action@v1
with:
version: ${{ steps.context.outputs.current-version }}
files-to-update: |
Source/VersionInfo.cs
Source/VersionInfo.go
Source/VersionInfo.ts
Source/VersionInfo.js
```
## Contributing
We're always open for contributions and bug fixes!

### Pre requisites
node <= 12
yarn
git
54 changes: 54 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Update VersionInfo Files
description: Updates version info in source files before building to include the build information in the released binaries.
inputs:
version:
description: Version of the release to use to replace values in the specified files.
required: true
files-to-update:
description: A comma or newline separated list of files to replace values in.
required: true
allow-multiple-replacements:
description: Whether or not to allow multiple replacements of each value in a file. Defaults to 'false'.
required: false
allow-no-replacements:
description: Whether or not to allow no replacements of each value in a file. Defaults to 'false'.
required: false
replacements:
description: A comma separated list of values to replace. Items can be any of (major, minor, patch, prerelease, full). Defaults to 'major, minor, patch, prerelease'.
required: false

major-type:
description: The type of literal to replace for the 'major' replacement. Can be (string, number, exact). Defaults to 'number'.
required: false
major-match:
description: The value to find for the 'major' replacement. Defaults to '377'.
required: false
minor-type:
description: The type of literal to replace for the 'minor' replacement. Can be (string, number, exact). Defaults to 'number'.
required: false
minor-match:
description: The value to find for the 'minor' replacement. Defaults to '389'.
required: false
patch-type:
description: The type of literal to replace for the 'patch' replacement. Can be (string, number, exact). Defaults to 'number'.
required: false
patch-match:
description: The value to find for the 'patch' replacement. Defaults to '368'.
required: false
prerelease-type:
description: The type of literal to replace for the 'prerelease' replacement. Can be (string, number, exact). Defaults to 'string'.
required: false
prerelease-match:
description: The value to find for the 'prerelease' replacement. Defaults to 'PRERELEASE'.
required: false
full-type:
description: The type of literal to replace for the 'full' replacement. Can be (string, number, exact). Defaults to 'string'.
required: false
full-match:
description: The value to find for the 'full' replacement. Defaults to '377.389.368-PRERELEASE'.
required: false


runs:
using: 'node12'
main: 'release/index.js'
Loading

0 comments on commit 5fcb2ce

Please # to comment.