Add a github action to bump version numbers

This commit is contained in:
Olivier Goffart 2021-08-10 08:53:15 +02:00
parent f0a7c4f817
commit 74c00b1cec
3 changed files with 59 additions and 2 deletions

57
.github/workflows/updgrade_version.yaml vendored Normal file
View file

@ -0,0 +1,57 @@
# LICENSE BEGIN
# This file is part of the SixtyFPS Project -- https://sixtyfps.io
# Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
# Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
#
# SPDX-License-Identifier: GPL-3.0-only
# This file is also available under commercial licensing terms.
# Please contact info@sixtyfps.io for more information.
# LICENSE END
name: Upgrade Version Number
on:
workflow_dispatch:
inputs:
new_version:
description: "The new version number"
required: true
jobs:
upgrade_version_number:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Do replacements
run: |
# Each Cargo.toml need to have the version updated
sed -i 's/^version = "[0-9]*\.[0-9]*\.[0-9]*"/version = "${{ github.event.inputs.new_version }}"/' **/Cargo.toml
# Each dependencies in cargo.toml
sed -i 's/\(sixtyfps.*version = \)"=[0-9]*\.[0-9]*\.[0-9]*"/\1"=${{ github.event.inputs.new_version }}"/' **/Cargo.toml
# Update the version in CmakeLists.txt
sed -i 's/ VERSION [0-9]*\.[0-9]*\.[0-9]*$/ VERSION ${{ github.event.inputs.new_version }}"/' api/sixtyfps-cpp/CMakeLists.txt
sed -i "s/(CPACK_PACKAGE_VERSION_MAJOR [0-9]*)/(CPACK_PACKAGE_VERSION_MAJOR `echo ${{ github.event.inputs.new_version }} | sed "s/\([0-9]*\)\.\([0-9]*\).\([0-9]*\)/\1/"`)/" api/sixtyfps-cpp/CMakeLists.txt
sed -i "s/(CPACK_PACKAGE_VERSION_MINOR [0-9]*)/(CPACK_PACKAGE_VERSION_MINOR `echo ${{ github.event.inputs.new_version }} | sed "s/\([0-9]*\)\.\([0-9]*\).\([0-9]*\)/\2/"`)/" api/sixtyfps-cpp/CMakeLists.txt
sed -i "s/(CPACK_PACKAGE_VERSION_PATCH [0-9]*)/(CPACK_PACKAGE_VERSION_PATCH `echo ${{ github.event.inputs.new_version }} | sed "s/\([0-9]*\)\.\([0-9]*\).\([0-9]*\)/\3/"`)/" api/sixtyfps-cpp/CMakeLists.txt
# The version is also in these files
sed -i "s/^version = '[0-9]*\.[0-9]*\.[0-9]*'/version = '${{ github.event.inputs.new_version }}'/" api/sixtyfps-cpp/docs/conf.py
# Version in package.json files
git ls-files | grep package.json | xargs sed -i 's/"version": ".*"/"version": "${{ github.event.inputs.new_version }}"/
# VersionCheck
sed -i "s/VersionCheck_[0-9]*_[0-9]*_[0-9]*;/VersionCheck_`echo ${{ github.event.inputs.new_version }} | sed "s/\([0-9]*\)\.\([0-9]*\).\([0-9]*\)/\1/"`_`echo ${{ github.event.inputs.new_version }} | sed "s/\([0-9]*\)\.\([0-9]*\).\([0-9]*\)/\2/"`_`echo ${{ github.event.inputs.new_version }} | sed "s/\([0-9]*\)\.\([0-9]*\).\([0-9]*\)/\3/"`/
echo "Note that the version is not updated in the documentation and README yet"
- name: Commit
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
git commit -a --message "Bump version number to ${{ github.event.inputs.new_version }}"
- name: Result
run: |
git diff
#TODO: commit the result

View file

@ -146,7 +146,7 @@ configure_package_config_file("cmake/SixtyFPSConfig.cmake.in" "${CMAKE_CURRENT_B
write_basic_package_version_file( write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/SixtyFPS/SixtyFPSConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/SixtyFPS/SixtyFPSConfigVersion.cmake
VERSION 0.1.0 VERSION 0.1.0
COMPATIBILITY ExactVersion COMPATIBILITY SameMinorVersion
) )
install(FILES install(FILES

View file

@ -312,7 +312,7 @@ namespace sixtyfps {{
namespace private_api {{ enum class VersionCheck {{ Major = {}, Minor = {}, Patch = {} }}; class WindowRc; }} namespace private_api {{ enum class VersionCheck {{ Major = {}, Minor = {}, Patch = {} }}; class WindowRc; }}
namespace cbindgen_private {{ using sixtyfps::private_api::WindowRc; using namespace vtable; struct KeyEvent; using private_api::Property; using private_api::PathData; }} namespace cbindgen_private {{ using sixtyfps::private_api::WindowRc; using namespace vtable; struct KeyEvent; using private_api::Property; using private_api::PathData; }}
}}", }}",
0, 1, 0, env!("CARGO_PKG_VERSION_MAJOR"), env!("CARGO_PKG_VERSION_MINOR"), env!("CARGO_PKG_VERSION_PATCH"),
)) ))
.with_trailer(gen_item_declarations(&items)) .with_trailer(gen_item_declarations(&items))
.generate() .generate()