Skip to content

Commit

Permalink
Added automatic build Numbers. Part of #73
Browse files Browse the repository at this point in the history
  • Loading branch information
iinsertNameHere committed May 8, 2024
1 parent 858581f commit 665a8b9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ on:
push:
pull_request:
permissions:
contents: read
pull-requests: read
contents: read|write
pull-requests: read|write
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -21,5 +21,13 @@ jobs:
run: nim release
- name: 'Install Figlet'
run: sudo apt-get install figlet
- name: 'Test Catnip'
- name: 'Run Tests'
run: cd tests && ./test.sh
- name: 'Add build Number'
run: echo 'const BUILDNUMBER = "${{ github.run_id }}"' > ./src/catniplib/global/buildnum.nim
- name: 'Push build Number'
run: |
git config --global user.name 'iinsertNameHere'
git config --global user.email '[email protected]'
git commit -am "Automatic build Number update"
git push
4 changes: 3 additions & 1 deletion src/catnip.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ from unicode import toLower
import strutils
import strformat
import std/wordwrap

import "catniplib/platform/probe"
from "catniplib/global/buildnum" import BUILDNUMBER

# Debug code for execution time
when not defined release:
Expand Down Expand Up @@ -49,6 +49,8 @@ proc printHelp(cfg: Config) =
echo "DistroIds:"
echo " " & cfg.getAllDistros().join(", ").wrapWords(80).replace("\n", "\n ")
echo ""
echo "Catnip - Build " & BUILDNUMBER
echo ""
quit()

# Handle commandline args
Expand Down
1 change: 1 addition & 0 deletions src/catniplib/global/buildnum.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const BUILDNUMBER* = "N/A"

0 comments on commit 665a8b9

Please sign in to comment.