зеркало из https://github.com/nextcloud/cookbook.git
Updated structure
This commit is there to prevent accidential modification of git history Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Родитель
a0bb30df4b
Коммит
958066875a
|
@ -15,7 +15,6 @@ master_branch=master
|
|||
major=$(cat "$deploy_path/major")
|
||||
minor=$(cat "$deploy_path/minor")
|
||||
patch=$(cat "$deploy_path/patch")
|
||||
suffix=$(cat "$deploy_path/suffix")
|
||||
|
||||
# release
|
||||
message="$(cat "$1")"
|
||||
|
@ -41,54 +40,40 @@ elif echo "$message" | grep '%MINOR%' > /dev/null; then
|
|||
|
||||
else
|
||||
|
||||
prerelease="$(parse_pre_release "$message")"
|
||||
|
||||
if [ -n "$suffix" ]; then
|
||||
# The previous version was a pre-release
|
||||
|
||||
if [ -n "$prerelease" ]; then
|
||||
# A new pre-release should be published
|
||||
suffix="$prerelease"
|
||||
else
|
||||
# A real release should be published
|
||||
suffix=''
|
||||
fi
|
||||
else
|
||||
# The previous release was a real release
|
||||
|
||||
let patch=$patch+1
|
||||
|
||||
if [ -n "$prerelease" ]; then
|
||||
# The next release is a pre-release
|
||||
suffix="$prerelease"
|
||||
fi
|
||||
fi
|
||||
echo 'Creating patch version'
|
||||
let patch=$patch+1
|
||||
|
||||
fi
|
||||
|
||||
echo "Updating bumped version files"
|
||||
echo $major > "$deploy_path/major"
|
||||
echo $minor > "$deploy_path/minor"
|
||||
echo $patch > "$deploy_path/patch"
|
||||
echo "$suffix" > "$deploy_path/suffix"
|
||||
|
||||
git add "$deploy_path/major" "$deploy_path/minor" "$deploy_path/patch" "$deploy_path/suffix"
|
||||
|
||||
prerelease="$(parse_pre_release "$message")"
|
||||
version="$major.$minor.$patch"
|
||||
if [ -n "$suffix" ]; then
|
||||
version="$version-$suffix"
|
||||
|
||||
if [ -n "$prerelease" ]; then
|
||||
# We want to build a pre-release
|
||||
echo "Not Updating the version files as we are creating a pre-release."
|
||||
version="$version-$prerelease"
|
||||
else
|
||||
echo "Updating bumped version files"
|
||||
echo $major > "$deploy_path/major"
|
||||
echo $minor > "$deploy_path/minor"
|
||||
echo $patch > "$deploy_path/patch"
|
||||
fi
|
||||
echo "New version is $version."
|
||||
|
||||
echo "The new version is $version."
|
||||
|
||||
echo "Storing new release version in $deploy_path/last_release"
|
||||
echo "$version" > "$deploy_path/last_release"
|
||||
|
||||
"$deploy_path/update-data.sh" "$version" "$major" "$minor" "$prerelease"
|
||||
|
||||
exit
|
||||
|
||||
git add "$deploy_path/major" "$deploy_path/minor" "$deploy_path/patch" "$deploy_path/last_release"
|
||||
git add package.json lib/Controller/MainController.php appinfo/info.xml
|
||||
|
||||
git config user.name 'Github actions bot'
|
||||
git config user.email 'bot@noreply.github.com'
|
||||
|
||||
"$deploy_path/update-data.sh"
|
||||
|
||||
git add package.json lib/Controller/MainController.php appinfo/info.xml
|
||||
|
||||
git commit -s -m "Bump to version $version"
|
||||
git tag "v$version"
|
||||
|
||||
|
|
|
@ -2,32 +2,39 @@
|
|||
|
||||
# set -x
|
||||
|
||||
deploy_path='.github/actions/deploy'
|
||||
if [ "$1" = "--from-files" ]; then
|
||||
deploy_path='.github/actions/deploy'
|
||||
|
||||
major=$(cat "$deploy_path/major")
|
||||
minor=$(cat "$deploy_path/minor")
|
||||
patch=$(cat "$deploy_path/patch")
|
||||
suffix=$(cat "$deploy_path/suffix")
|
||||
major=$(cat "$deploy_path/major")
|
||||
minor=$(cat "$deploy_path/minor")
|
||||
patch=$(cat "$deploy_path/patch")
|
||||
suffix=''
|
||||
|
||||
version="$major.$minor.$patch"
|
||||
|
||||
version="$major.$minor.$patch"
|
||||
|
||||
if [ -n "$suffix" ]; then
|
||||
version="$version-$suffix"
|
||||
elif [ $# -eq 5 ]; then
|
||||
version="$1"
|
||||
major="$2"
|
||||
minor="$3"
|
||||
patch="$4"
|
||||
suffix="$5"
|
||||
else
|
||||
echo "Unsupported command line parameters. Please provide either --from-files or 5 parameters for version, major, minor, patch and suffix."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fill_in_data () {
|
||||
echo "Updating info.xml"
|
||||
cat .github/actions/deploy/appinfo/info.xml.dist | sed "s/%%VERSION%%/$version/g" > appinfo/info.xml
|
||||
echo "Updating info.xml"
|
||||
cat .github/actions/deploy/appinfo/info.xml.dist | sed "s/%%VERSION%%/$version/g" > appinfo/info.xml
|
||||
git add appinfo/info.xml
|
||||
|
||||
echo "Updating package.json"
|
||||
sed "s/\"version\": \\?\"[^\"]*\"/\"version\": \"$version\"/g" -i package.json
|
||||
echo "Updating package.json"
|
||||
sed "s/\"version\": \\?\"[^\"]*\"/\"version\": \"$version\"/g" -i package.json
|
||||
git add package.json
|
||||
|
||||
echo "Updating version in main controller"
|
||||
local version_arr="$major, $minor, $patch"
|
||||
if [ -n "$suffix" ]; then
|
||||
version_arr="$version_arr, -$suffix"
|
||||
fi
|
||||
sed "/VERSION_TAG/s@[[].*[]]@[$version_arr]@" -i lib/Controller/MainController.php
|
||||
}
|
||||
|
||||
fill_in_data
|
||||
echo "Updating version in main controller"
|
||||
version_arr="$major, $minor, $patch"
|
||||
if [ -n "$suffix" ]; then
|
||||
version_arr="$version_arr, -$suffix"
|
||||
fi
|
||||
sed "/VERSION_TAG/s@[[].*[]]@[$version_arr]@" -i lib/Controller/MainController.php
|
||||
git add lib/Controller/MainController.php
|
||||
|
|
2
Makefile
2
Makefile
|
@ -160,4 +160,4 @@ code_style:
|
|||
npm run prettier-fix
|
||||
|
||||
appinfo/info.xml: .github/actions/deploy/patch .github/actions/deploy/minor .github/actions/deploy/major .github/actions/deploy/appinfo/info.xml.dist
|
||||
.github/actions/deploy/update-data.sh
|
||||
.github/actions/deploy/update-data.sh --from-files
|
||||
|
|
|
@ -47,13 +47,16 @@ Here is the last chance to do some testing and verification.
|
|||
Now the critical part comes.
|
||||
As soon as you merge the PR you set the gears into action and a new release will be published both on github and the NC appstore.
|
||||
|
||||
#### Regular releases
|
||||
|
||||
The version number that is going to be generated **depends on the commit message of the merge commit into `stable`**.
|
||||
So before clicking on *Merge* be sure what you are doing.
|
||||
So before clicking on *Merge* be sure you know what you are doing.
|
||||
|
||||
By default you will generate a new patch version.
|
||||
So the third part of our version would be incremented.
|
||||
If you want to generate a different version type like minor (second part incremented) or major version (first part incremented), you need to make this visible.
|
||||
You have to put a keyword on a line in the commit message to select a version type other than a patch version.
|
||||
The following table shows the effect of the keywords if the last version was `1.2.3`.
|
||||
|
||||
| Keyword | Version type | Generated version |
|
||||
|---|---|---|
|
||||
|
@ -65,11 +68,30 @@ The automatic deployment action will take over once you push to the `stable` bra
|
|||
The following actions will take place after the merge:
|
||||
|
||||
1. Some fixed parameters will be pre-filled in the codebase with the version number and a commit is generated on the `stable` branch.
|
||||
1. A new tag `v1.2.4` is generated to save the current state in history on the `stable` branch.
|
||||
1. A new tag `v1.2.4` (or similar) is generated to save the current state in history on the `stable` branch.
|
||||
1. The changes introduced in the commit are merged back into the `master` branch.
|
||||
1. A github release is published and the compiled files are uploaded as a tarball.
|
||||
1. A release in the nextcloud appstore is registered and published.
|
||||
|
||||
#### Pre-releases
|
||||
It is also possible to publish a pre-release like `1.4.2-beta1` or `4.0.2-rc1`.
|
||||
The user/developer is responsible to provide a valid suffix for the pre-release.
|
||||
The created pre-release version is **not permanently stored**.
|
||||
|
||||
The reasoning of not storing the last pre-release version is that the next regular release (of whatever version level) must not increase the major/minor/patch version multiple times.
|
||||
Also it might be required to change from a patch to minor or from minor to major level updates:
|
||||
... > `1.2.3` > `1.2.4-rc1` > `1.3.0-rc1` > `1.3.0` > ... .
|
||||
|
||||
A pre-release is created by adding additionally to the keywords as described in the [regular releases section](#regular-releases) the additional keyword `%PRE-RELEASE%<suffix>%`.
|
||||
The value `<suffix>` will be used as the suffix of the pre-release.
|
||||
Assume, you are on version `1.2.3`, the following table explains the resulting release versions:
|
||||
|
||||
| Keyword | Generated version |
|
||||
|---|---|
|
||||
| `%PRE-RELEASE%rc1%` | 1.2.4-rc1 |
|
||||
| `%MINOR% %PRE-RELEASE%alpha3%` | 1.3.0-alpha3 |
|
||||
| `%PRE-RELEASE%beta.1% %MAJOR%` | 2.0.0-beta.1 |
|
||||
|
||||
## Implementation details
|
||||
|
||||
The most recent version is stored in the files `major`, `minor`, and `patch` in `.github/actions/deploy/`.
|
||||
|
|
Загрузка…
Ссылка в новой задаче