Skip to content

Commit

Permalink
feat(GH-8): Add git versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
gavanlamb committed Jun 14, 2024
1 parent 19e5c78 commit b5d0500
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ jobs:
node-version-file: .node-version

- name: Get version
uses: gavanlamb/github-actions/.github/actions/version/get@main
id: get-version
uses: gittools/actions/gitversion/execute@v1.1.1
with:
targetPath: ./
disableCache: true
useConfigFile: true
configFilePath: GitVersion.yml
env:
BUILD_NUMBER: ${{ github.run_number }}

- name: Set version
run: |
npm version --no-git-tag-version --allow-same-version ${{ steps.get-version.outputs.sem-ver }}
npm version --no-git-tag-version --allow-same-version ${{ steps.get-version.outputs.semVer }}
- name: Restore dependencies
run: |
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: 'Preview'

on:
pull_request:

concurrency:
cancel-in-progress: false
group: release-${{ github.ref_name }}

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version

- name: Get version
uses: gavanlamb/github-actions/.github/actions/version/get@main
id: get-version
env:
BUILD_NUMBER: ${{ github.run_number }}

- name: Set version
run: |
npm version --no-git-tag-version --allow-same-version ${{ steps.get-version.outputs.sem-ver }}
- name: Restore dependencies
run: |
npm ci
- name: Lint
run: |
npm run lint
- name: Test
run: |
npm run test
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
./test-results/junit.xml
- name: Publish test coverage
uses: ArtiomTr/jest-coverage-report-action@v2
if: always()
with:
skip-step: all
coverage-file: ./test-results/summary.json
base-coverage-file: ./test-results/summary.json
prnumber: ${{ github.event.pull_request.number }}

- name: Package
run: |
npm run package
49 changes: 49 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
assembly-versioning-format: '{Major}.{Minor}.{Patch}'
assembly-file-versioning-format: '{Major}.{Minor}.{Patch}'
assembly-informational-format: '{Major}.{Minor}.{Patch}'
tag-prefix: v

major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'

legacy-semver-padding: 0
build-metadata-padding: 0
commit-message-incrementing: Disabled
commit-date-format: 'o'
update-build-number: true

mode: mainline

branches:
main:
regex: ^main$
increment: Minor
prevent-increment-of-merged-branch-version: false
is-mainline: true
hotfix:
regex: ^(hotfix|hf)[/]
source-branches:
- main
increment: Patch
feature:
regex: ^(feature|feat|fix|docs|style|refactor|test|chore)[/]
tag: alpha
source-branches:
- main
- feature
increment: None
pull-request:
regex: ^(pull|pull\-requests|pr)[/]
tag: preview
source-branches:
- main
- feature
- hotfix
increment: None
tag-number-pattern: '[/-](?<number>\d+)[-/]'

ignore:
sha: []
merge-message-formats: {}

0 comments on commit b5d0500

Please sign in to comment.