Skip to content

Commit

Permalink
add a version file
Browse files Browse the repository at this point in the history
  • Loading branch information
nh758 committed Sep 15, 2023
1 parent 54baac9 commit 7f01779
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Bump Version
# Increments the version using semver and saves it to version (text file)
# Creates a tagged commit with using the new version
on:
workflow_call:
inputs:
type:
description: Release type (should be major, minor or patch)
required: true
type: string
ref:
type: string
default: ${{ github.ref }}
outputs:
new_version:
value: ${{ jobs.bump.outputs.new_version }}
jobs:
bump:
name: Bump Version
runs-on: ubuntu-latest
if: ${{ inputs.type != 'no_release' }}
outputs:
new_version: ${{ steps.increment_version.outputs.new_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}

- name: Install semver
run: npm i semver -g

- name: Increment the Runtime Version
id: increment_version
env:
TYPE: ${{ inputs.type }}
run: |
CURRENT=$(cat version)
NEW=$(semver -i $TYPE $CURRENT)
echo $NEW > version
echo "new_version=$NEW" >> $GITHUB_OUTPUT

- name: Commit Change
id: commit_version
uses: EndBug/add-and-commit@v9
env:
NEW_VERSION: ${{ steps.increment_version.outputs.new_version }}
with:
message: Update version ${{ env.NEW_VERSION }}
tag: v${{ env.NEW_VERSION }}
default_author: github_actions

2 changes: 1 addition & 1 deletion .github/workflows/pr-merge-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Version
# Only run if tests pass
needs: [ call-get-label, call-e2e-tests ]
uses: digi-serve/.github/.github/workflows/bump-version.yml@master
uses: ./.github/workflows/bump-version.yml
with:
ref: ${{ github.ref }}
type: ${{ needs.call-get-label.outputs.label }}
Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0

0 comments on commit 7f01779

Please sign in to comment.