Skip to content

Commit

Permalink
Incorporate a semantic version generator (#313)
Browse files Browse the repository at this point in the history
* Incorporate a semantic version generator

* Fix script?

* Another script fix

* Yet another script fix

* List tags

* Try changing version_format

* Comment out the expensive bits

* Maybe need to remove this option?

* Update version_format?

* Remove namespace

* Try echoing version again

* Echo again

* More echo

* Generate version.txt

* Update version.txt

* Restore rest of build process

* Code Factor

* Fix zip creation
  • Loading branch information
Idhrendur committed Apr 3, 2023
1 parent 6653e43 commit 3c20a14
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 9 deletions.
52 changes: 48 additions & 4 deletions .github/workflows/windows_build_test_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,50 @@ jobs:
git -c submodule."external/commonItems".update=none `
submodule update --init --recursive external\Fronter
- name: "Generate semantic version number"
uses: paulhatch/semantic-version@v5.0.2
id: version_number
with:
# The prefix to use to identify tags
tag_prefix: "v"
# A string which, if present in a git commit, indicates that a change represents a
# major (breaking) change, supports regular expressions wrapped with '/'
major_pattern: "(MAJOR)"
# A string which indicates the flags used by the `major_pattern` regular expression. Supported flags: idgs
major_regexp_flags: ""
# Same as above except indicating a minor change, supports regular expressions wrapped with '/'
minor_pattern: "(MINOR)"
# A string which indicates the flags used by the `minor_pattern` regular expression. Supported flags: idgs
minor_regexp_flags: ""
# A string to determine the format of the version output
version_format: "v${major}.${minor}.${patch}"
# If this is set to true, *every* commit will be treated as a new version.
bump_each_commit: true
# If true, the body of commits will also be searched for major/minor patterns to determine the version type.
search_commit_body: false
# The output method used to generate list of users, 'csv' or 'json'.
user_format_type: "csv"

- name: "Echo version number"
run: |
echo ${{ steps.version_number.outputs.major }}
echo ${{ steps.version_number.outputs.minor }}
echo ${{ steps.version_number.outputs.patch }}
- name: "Create version file"
run: |
echo '# Version info' > data/version.txt
echo '' >> data/version.txt
echo 'version = "${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}.${{ steps.version_number.outputs.patch }}"' >> data/version.txt
echo 'name = "Null"' >> data/version.txt
echo 'source = "Vic3"' >> data/version.txt
echo 'minSource = "1.0"' >> data/version.txt
echo 'maxSource = "1.2"' >> data/version.txt
echo 'target = "HoI4"' >> data/version.txt
echo 'minTarget = "1.12"' >> data/version.txt
echo 'maxTarget = "1.12"' >> data/version.txt
cat data/version.txt
- name: "Build solution"
run: |
cd "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\"
Expand All @@ -44,23 +88,23 @@ jobs:
- name: "Prepare release"
run: |
cd "C:\Program Files\7-Zip\"
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-0.0Null-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release\*
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release\*
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-latest-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release\*
- name: "Prepare installer"
run: |
c:\"Program Files (x86)\Inno Setup 6\iscc" Vic3ToHoI4-Installer.iss
cp $Env:GITHUB_WORKSPACE\Output\Vic3ToHoI4-latest-win-x64.exe $Env:GITHUB_WORKSPACE\Output\Vic3ToHoI4-0.0Null-win-x64.exe
cp $Env:GITHUB_WORKSPACE\Output\Vic3ToHoI4-latest-win-x64.exe $Env:GITHUB_WORKSPACE\Output\Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.exe
- name: "Upload binaries to named release"
if: ${{ github.event_name == 'push' }}
uses: ncipollo/release-action@v1
with:
tag: 0.0Null
tag: ${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}.0
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
artifacts: Vic3ToHoI4-0.0Null-win-x64.zip, Output\Vic3ToHoI4-0.0Null-win-x64.exe
artifacts: Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.zip, Output\Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.exe
token: ${{ secrets.API_TOKEN_GITHUB }}

- name: "Upload binaries to latest release"
Expand Down
6 changes: 3 additions & 3 deletions data/version.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Version info

version = "0.0"
version = "0.0.0"
name = "Null"
source = "Vic3"
minSource = "1.0"
maxSource = "1.0"
maxSource = "1.2"
target = "HoI4"
minTarget = "1.11.4"
minTarget = "1.12"
maxTarget = "1.12"
4 changes: 2 additions & 2 deletions docs/release_checklist.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
* Add new banner to data/resources/images
* Create new tag on github
* Update data/version.txt with new version and name
* Update .github/workflows/windows_build_test_and_push.yml with new filename, tag, and artifact
* Update .github/workflows/windows_build_test_and_push.yml with new name, filename, tag, and artifact
* Create commit with MINOR or MAJOR in the commit message as appropriate, and tagged with new version
* Push and merge on github
* Wait for build, confirm updates
* New post on forum thread
Expand Down

0 comments on commit 3c20a14

Please sign in to comment.