Skip to content

Commit

Permalink
major: Init versioning (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcanfield authored Nov 5, 2023
1 parent 3e45232 commit 29c8f27
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"digest"
],
"commitBody": "Change-type: {{updateType}}",
"automerge": true
"automerge": true,
"automergeType": "branch"
}
],
"prHourlyLimit": 8
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
files: changelog.md
draft: false
prerelease: false
62 changes: 62 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Create Git Tag

on:
push:
branches:
- main

jobs:
create-tag:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Extract version and commit message
id: extract-info
run: |
cat version.txt
version=$(cat version.txt) # Replace with the path to your version file
echo "::set-output name=version::$version"
echo "::set-output name=commit_message::$commit_message"
- name: Determine version increment
id: increment-version
run: |
commit_message=$(git log -1 --pretty=%s)
major_version=$(echo ${{ steps.extract-info.outputs.version }} | awk -F'.' '{print $1}')
minor_version=$(echo ${{ steps.extract-info.outputs.version }} | awk -F'.' '{print $2}')
echo "$commit_message"
if [[ $commit_message == *"major"* ]]; then
echo "New major version"
new_major_version=$((major_version + 1))
new_version="$new_major_version.0"
else
echo "New minor version"
new_minor_version=$((minor + 1))
new_version="$major_version.$new_minor_version"
fi
echo "::set-output name=new_version::$new_version"
- name: Update version.txt
run: |
echo "${{ steps.increment-version.outputs.new_version }}" > version.txt
git config user.name "bcanfield"
git config user.email "[email protected]"
git add version.txt
- name: Update changelog.md
run: |
echo "## v${{ steps.increment-version.outputs.new_version }}" >> changelog.md
echo "- Change: ${{ steps.extract-info.outputs.commit_message }}" >> changelog.md
echo "" >> changelog.md
git add changelog.md
git commit -m "v${{ steps.increment-version.outputs.new_version }}"
git push
- name: Create Git Tag
run: |
git tag -a -m "v${{ steps.increment-version.outputs.new_version }}" v${{ steps.increment-version.outputs.new_version }}
git push origin v${{ steps.increment-version.outputs.new_version }}
59 changes: 59 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## Version 0.0.1
- Commit Message: Test
- Commit Body: Test

## Version 0.0.2
- Commit Message: Test
- Commit Body:

## Version 0.0.3
- Commit Message: Test
- Commit Body:

## Version 0.0.4
- Commit Message: Test2
- Commit Body:

## Version 0.0.5
- Commit Message: Test2
- Commit Body:

## Version 0.0.6
- Commit Message: Test2
- Commit Body:

## Version 0.0.7
- Commit Message: Test
- Commit Body:

## Version 0.0.8
- Commit Message: Test2
- Commit Body:

## Version 0.1
- Change: test

## Version 0.1
- Change: major: test

## Version 0.1
- Change: major: test

## Version 0.1
- Change: major

## Version 0.1
- Change: major test

## Version 0.1
- Change: major test

## Version 0.1
- Change: major test

## Version 1.0
- Change:

## v1.1
- Change:

9 changes: 9 additions & 0 deletions homepage/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html>
<html>
<head>
<title>This is the title of the webpage!</title>
</head>
<body>
<p>This is an example paragraph. Anything in the <strong>body</strong> tag will appear on the page, just like this <strong>p</strong> tag and its contents.</p>
</body>
</html>
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0

0 comments on commit 29c8f27

Please sign in to comment.