-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create release upon each build and standardize version numbers (#71)
* Create release upon each build and standardize version numbers Each push to a PR will create builds (as artifacts only) with the version number of X.Y.Z and a stamp of gABCDEFA, where X.Y is the last tag in the main repo of the form vX.Y, Z is the number of commits since then, and ABCDEFA is the git hash of the tip of PR Each push to main (icosa-gallery only) will create artifacts of the form X.Y.Z (same meaning as above), as well as an easier to use 'pre-release' release on the github releases page. It will also tag the commit with X.Y.Z (no 'v') to make it easier to cross-reference. Each push of a tag of the format vX.Y to main will create an official release named X.Y.0. Both of these releases include the same 4 files; Windows + Oculus, regular + Experimental. The other artifacts (Mac OS X, Linux, Windows Monoscopic) remain available from the Artifacts page, but are not exposed on the 'releases' link. All Oculus builds are signed, and the android-specific bundleVersionCode is now updated automatically (1000000*X+1000*Y+Z). Creating a new formal release requires two steps: * Update the following three files, create a PR as usual, and merge it: Assets/Scenes/Main.unity: m_VersionNumber: X.Y.0 ProjectSettings/ProjectSettings.asset: bundleVersion: X.Y.0 README.md:## Current Version: `X.Y.0` * Tag the merge commit with `vX.Y` (do not include the .0), and push the tag to trigger the actual build of X.Y.0.
- Loading branch information
Showing
3 changed files
with
159 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,80 @@ name: Builds | |
|
||
on: | ||
pull_request: {} | ||
push: {branches: [main]} | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*" | ||
|
||
env: | ||
#UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
UNITY_LICENSE: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"576562626572264761624c65526f7578\"/>\n <Binding Key=\"2\" Value=\"576562626572264761624c65526f7578\"/>\n </MachineBindings>\n <MachineID Value=\"D7nTUnjNAmtsUMcnoyrqkgIbYdM=\"/>\n <SerialHash Value=\"b24e2ad2b9d60ad5aace4fde9911fc1c1f659e36\"/>\n <Features>\n <Feature Value=\"33\"/>\n <Feature Value=\"1\"/>\n <Feature Value=\"12\"/>\n <Feature Value=\"2\"/>\n <Feature Value=\"24\"/>\n <Feature Value=\"3\"/>\n <Feature Value=\"36\"/>\n <Feature Value=\"17\"/>\n <Feature Value=\"19\"/>\n <Feature Value=\"62\"/>\n </Features>\n <DeveloperData Value=\"AQAAAEY0LURFQ1ktRDhXTS01OTRHLUU5UlctQ0FYOA==\"/>\n <SerialMasked Value=\"F4-DECY-D8WM-594G-E9RW-XXXX\"/>\n <StartDate Value=\"2021-02-07T00:00:00\"/>\n <UpdateDate Value=\"2021-03-10T23:13:19\"/>\n <InitialActivationDate Value=\"2021-02-07T12:51:19\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2019.4.18f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" ValidTo=\"9999-12-31T00:00:00\"/>\n <Entitlement Ns=\"unity_editor\" Tag=\"DarkSkin\" Type=\"EDITOR_FEATURE\" ValidTo=\"9999-12-31T00:00:00\"/>\n </Entitlements>\n </License>\n<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\"/><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><Reference URI=\"#Terms\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>EQ57QnLpZQy5Ft2KgPCV+PcFuPg=</DigestValue></Reference></SignedInfo><SignatureValue>z+iLsAtgjx6jf0J41On79ErzFJdljmwNPvvBUEMpsdzf4E6GjFZIzpUfn1BA5livZmnmWTI3eF1V\nJ+0aIjkVfAIo0M8yhKcM1vj4+mUMhO7xZh3ipDtlnakdATvWrOBBFWLQO4rYADdkfvmIG1uLaadq\nGiTsxaXA/Vap2ffI+ECeUqtBdIwHLON4vEL6p1VKyUfbtAoafxnr9d1+kQaH0TAe60/J1Z8D6kmP\n5M/iCoWQaFq+Zo+0ACiXQikPt17lIhlwX0be+FuSa0WOwOBSnJyuzy+cpsd4ZQi724rQKbNtOx7M\nxq+FlamO+TPP26L6zIes+zfHCa/WD1+d9r1kuQ==</SignatureValue></Signature></root>" | ||
|
||
jobs: | ||
configuration: | ||
name: Configure Build Parameters | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.version.outputs.version}} | ||
stamp: ${{ steps.version.outputs.stamp }} | ||
prerelease: ${{ steps.version.outputs.prerelease }} | ||
changelog: ${{ steps.changelog.outputs.changelog }} | ||
btbgithub: ${{ steps.btbgithub.outputs.btbgithub }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
lfs: true # We don't use LFS, but it adds no time, and leave it here in case we do at some point later | ||
|
||
- name: Calculate version and stamp | ||
id: version | ||
run: | | ||
MAJOR_MINOR=$(git describe --tags --abbrev=0 --match "v[0-9]*.[0-9]*" ${{ github.event.pull_request.head.sha }}) | ||
PATCH_VERSION=$(git describe --tags --match "v[0-9]*.[0-9]*" ${{ github.event.pull_request.head.sha }} | cut -d'-' -f2) | ||
STAMP=$(git describe --tags --match "v[0-9]*.[0-9]*" ${{ github.event.pull_request.head.sha }} | cut -d'-' -f3) | ||
if [ $PATCH_VERSION == $MAJOR_MINOR ] | ||
then | ||
PATCH_VERSION="0" | ||
STAMP="" | ||
echo "Formal version: $MAJOR_MINOR.$PATCH_VERSION" | ||
echo "::set-output name=prerelease::false" | ||
else | ||
echo "Prerelease version $MAJOR_MINOR.PATCH_VERSION $STAMP" | ||
echo "::set-output name=prerelease::true" | ||
fi | ||
VERSION=$(echo "$MAJOR_MINOR.$PATCH_VERSION" | sed -e 's/^v//') | ||
echo "::set-output name=version::$VERSION" | ||
echo "::set-output name=stamp::$STAMP" | ||
- name: Calculate Changelog | ||
id: changelog | ||
run: | | ||
if [ $(git describe --tags --abbrev=0) == $(git describe --tags) ] | ||
then | ||
PREV=$(git describe --tags --abbrev=0 HEAD^) | ||
else | ||
PREV=$(git describe --tags --abbrev=0) | ||
fi | ||
CHANGELOG=$(git log --pretty=oneline $PREV..HEAD) | ||
CHANGELOG="${CHANGELOG//'%'/'%25'}" | ||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" | ||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" | ||
echo "::set-output name=changelog::$CHANGELOG" | ||
- name: Set -btb-github if relevant | ||
id: btbgithub | ||
run: | | ||
MAJOR_MINOR=$(git describe --tags --abbrev=0 --match "v[0-9]*.[0-9]*" ${{ github.event.pull_request.head.sha }}) | ||
PATCH_VERSION=$(git describe --tags --match "v[0-9]*.[0-9]*" ${{ github.event.pull_request.head.sha }} | cut -d'-' -f2) | ||
if [ $PATCH_VERSION == $MAJOR_MINOR ] | ||
then | ||
echo "::set-output name=btbgithub::" | ||
else | ||
echo "::set-output name=btbgithub::-btb-github" | ||
fi | ||
build: | ||
name: ${{ matrix.name }} | ||
needs: configuration | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
|
@@ -53,7 +118,6 @@ jobs: | |
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # Used for finding the tag for git describe | ||
lfs: true # We don't use LFS, but it adds no time, and leave it here in case we do at some point later | ||
|
||
- name: Install Oculus unity package | ||
|
@@ -118,6 +182,8 @@ jobs: | |
with: | ||
unityVersion: 2019.4.18f1 | ||
targetPlatform: ${{ matrix.targetPlatform }} | ||
versioning: Custom | ||
version: ${{ needs.configuration.outputs.version }} | ||
buildMethod: OVRPluginUpdater.BatchmodePluginUpdate # We created this symlink above | ||
|
||
- name: Set filename (for Windows) | ||
|
@@ -141,16 +207,31 @@ jobs: | |
echo "filename=com.Icosa.OpenBrushgithub.apk" >> $GITHUB_ENV | ||
|
||
- name: Set build stamp | ||
if: ${{ github.event_name == 'pull_request' }} | ||
if: ${{ needs.configuration.outputs.stamp }} | ||
# We checkout the merge commit, but for the purpose of the tag, use the version from the PR, not the merge commit, which is rather hard to find later. We skip the version tag, since this comes from the code and can't be easily overwritten | ||
run: | | ||
# We checkout the merge commit, but for the purpose of the tag, use the version from the PR, not the merge commit, which is rather hard to find later. We skip the version tag, since this comes from the code and can't be easily overwritten | ||
GIT_DESCRIBE=$(git describe --tags ${{ github.event.pull_request.head.sha }} || true) | ||
if [ ! -z $GIT_DESCRIBE ] | ||
then | ||
echo "stamp=-btb-stamp $(echo $GIT_DESCRIBE | cut -d'-' -f2-)" >> $GITHUB_ENV | ||
else | ||
echo "No value for git describe found!" | ||
fi | ||
echo "stamp=-btb-stamp ${{needs.configuration.outputs.stamp}}" >> $GITHUB_ENV | ||
- name: Update version | ||
env: | ||
VERSION: ${{ needs.configuration.outputs.version}} | ||
run: | | ||
sed -e "s/m_VersionNumber:.*$/m_VersionNumber: $VERSION/" -i Assets/Scenes/Main.unity | ||
sed -e "s/bundleVersion:.*$/bundleVersion: $VERSION/" -i ProjectSettings/ProjectSettings.asset | ||
- name: Add secure secrets file | ||
env: | ||
SECRETS_ASSET: ${{ secrets.SECRETS_ASSET }} | ||
SECRETS_ASSET_META: ${{ secrets.SECRETS_ASSET_META }} | ||
if: | | ||
env.SECRETS_ASSET != null && | ||
env.SECRETS_ASSET_META != null | ||
run: | | ||
echo "$SECRETS_ASSET" > Assets/Secrets.asset | ||
echo "$SECRETS_ASSET_META" > Assets/Secrets.asset.meta | ||
SECRETS_ASSET_META_GUID=$(grep "guid:" Assets/Secrets.asset.meta | cut -d" " -f2) | ||
sed -e "s/Secrets:.*$/Secrets: {fileID: 11400000, guid: $SECRETS_ASSET_META_GUID, type: 2}/" -i Assets/Scenes/Main.unity | ||
- name: Enable the use of a custom keystore | ||
env: | ||
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | ||
|
@@ -168,11 +249,15 @@ jobs: | |
- name: Build project | ||
uses: game-ci/[email protected] | ||
env: | ||
VERSION: ${{ needs.configuration.outputs.version}} | ||
with: | ||
allowDirtyBuild: true # Because of the OVR Update, the build tree might be dirty | ||
unityVersion: 2019.4.18f1 | ||
targetPlatform: ${{ matrix.targetPlatform }} | ||
customParameters: -btb-target ${{ matrix.targetPlatform }} -btb-display ${{ matrix.vrsdk }} -btb-out /github/workspace/build/${{ matrix.targetPlatform }}-${{ matrix.vrsdk }}/${{ env.filename }} -btb-github ${{ env.stamp }} ${{ matrix.extraoptions }} | ||
customParameters: -btb-target ${{ matrix.targetPlatform }} -btb-display ${{ matrix.vrsdk }} -btb-out /github/workspace/build/${{ matrix.targetPlatform }}-${{ matrix.vrsdk }}/${{ env.filename }} ${{ needs.configuration.outputs.btbgithub }} ${{ env.stamp }} ${{ matrix.extraoptions }} | ||
versioning: Custom | ||
version: ${{ needs.configuration.outputs.version }} | ||
buildMethod: BuildTiltBrush.CommandLine | ||
androidKeystoreName: openbrush.keystore | ||
androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | ||
|
@@ -194,3 +279,61 @@ jobs: | |
name: ${{ matrix.name }} | ||
path: build | ||
|
||
release: | ||
name: Create Github Release | ||
needs: [configuration, build] | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.event_name == 'push' && | ||
github.repository == 'icosa-gallery/open-brush' | ||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Download Build Artifacts (Windows SteamVR) | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: Windows SteamVR | ||
path: build_windows_steamvr | ||
|
||
- name: Download Build Artifacts (Windows SteamVR Experimental) | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: Windows SteamVR Experimental | ||
path: build_windows_steamvr_experimental | ||
|
||
- name: Download Build Artifacts (Oculus Quest) | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: Oculus Quest | ||
path: build_oculus_quest | ||
|
||
- name: Download Build Artifacts (Oculus Quest Experimental) | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: Oculus Quest Experimental | ||
path: build_oculus_quest_experimental | ||
|
||
- name: Package Artifacts for release | ||
env: | ||
VERSION: ${{ needs.configuration.outputs.version }} | ||
run: | | ||
mkdir releases | ||
mv build_oculus_quest/*/com.Icosa.OpenBrush*apk releases/OpenBrush_Quest_$VERSION.apk | ||
mv build_oculus_quest_experimental/*/com.Icosa.OpenBrush*apk releases/OpenBrush_Quest_Experimental_$VERSION.apk | ||
mv build_windows_steamvr/StandaloneWindows64-SteamVR/ releases/OpenBrush_Desktop_$VERSION/ | ||
mv build_windows_steamvr_experimental/StandaloneWindows64-SteamVR/ releases/OpenBrush_Desktop_Experimental_$VERSION/ | ||
cd releases | ||
zip -r OpenBrush_Desktop_$VERSION.zip OpenBrush_Desktop_$VERSION/ | ||
zip -r OpenBrush_Desktop_Experimental_$VERSION.zip OpenBrush_Desktop_Experimental_$VERSION/ | ||
rm -rf OpenBrush_Desktop_$VERSION | ||
rm -rf OpenBrush_Desktop_Experimental_$VERSION | ||
- name: Publish | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
body: ${{ needs.configuration.outputs.changelog }} | ||
prerelease: ${{ needs.configuration.outputs.prerelease }} | ||
tag_name: ${{ needs.configuration.outputs.version }} | ||
files: releases/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters