Skip to content

Commit

Permalink
Create release upon each build and standardize version numbers (#71)
Browse files Browse the repository at this point in the history
* 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
mikeage authored Mar 31, 2021
1 parent 8e4951d commit a23e94f
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 18 deletions.
167 changes: 155 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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/*
2 changes: 1 addition & 1 deletion Assets/Editor/BuildTiltBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ static void CommandLine() {
// set externally?
i++;
} else if (args[i] == "-androidVersionCode") {
i++;
PlayerSettings.Android.bundleVersionCode = Int32.Parse(args[++i]);
} else if (args[i] == "-androidKeystoreName") {
keystoreName = args[++i];
} else if (args[i] == "-androidKeystorePass") {
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,10 @@ folder. They are not included in non-experimental builds.

## Bleeding Edge Releases

Instead of waiting for a formal release, starting with commit 8a7e51f679fa594a43fc2d7a5ae334acc4e46032, you can download a ZIP file containing the latest build, automatically generated, directly from Github. These versions are believed working and contain code that has undergone a code review, but may not have been fully tested and there is no guarantee as to their quality. However, if you'd like to test a recent change prior to the official release, you can use these either in place of or in parallel with the formal Open Brush releases.

To download a build from the "tip", go to [commits](https://github.com/icosa-gallery/open-brush/commits/main) and find the commit you want (generally the most recent one on the top). Click on the green check mark below the title (next to the XXX committed XXX ago), and scroll to the build you want, and click on **Details**. Then, towards the upper right corner, click on **Artifacts (6)** and click on the name of the build. Unzip the downloaded file, and either run the executable (Desktop SteamVR/Monoscopic) or install the apk (Android Oculus) using `adb install com.Icosa.OpenBrush-github.apk`.
Instead of waiting for a formal release, you can download a ZIP from Github containing an automatically built release for either Windows (SteamVR) or Oculus Quest / Quest 2 from the [Github releases page](https://github.com/icosa-gallery/open-brush/releases). Versions of the form "vX.Y.0" are official releases, whereas versions that do not end in .0 are made available for testing purposes only, with no guarantees as to their quality. Additionally, these releases are marked as "pre-release". However, if you'd like to test a recent change prior to the official release, you can use these either in place of or in parallel with the formal Open Brush releases.

These builds share a save location with the official Open Brush release, but can be installed alongside the formal version. The Oculus build, like all sideloaded content, will be listed in "Unknown Sources", and will have the word "Github" appended to the name (with a different package name as well) to differentiate it from the official release).

Note that the "experimental" builds (Windows/SteamVR and Android/Oculus only!) contain experimental brushes, and sketches created using the experimental brushes may appear differently when loaded in the official build of Open Brush!
Note that the "experimental" builds contain experimental brushes, and sketches created using the experimental brushes may appear differently when loaded in the official build of Open Brush!

Note that if you download a Mac OS X build, you'll need to run `xattr -d com.apple.quarantine /path/to/OpenBrush-github.app` prior to be able to launch the app, as it is not signed with Apple developer keys.
In addition, there are also versions created for Linux (SteamVR and Monoscopic), OS X (Monoscopic only), and Windows Monoscopic that are listed as "Artifacts" of the Github Actions, however, these are intended only for developers, and should not be used by general users. You can find them by browsing to the [commit list]((https://github.com/icosa-gallery/open-brush/commits/main), and then clicking on the green check mark below the title (next to the XXX committed XXX ago), and scroll to the build you want, and click on **Details**. Then, towards the upper right corner, click on **Artifacts (6)** and click on the name of the build. Unzip the downloaded file, and either run the executable (Desktop SteamVR/Monoscopic) or install the apk (Android Oculus) using `adb install com.Icosa.OpenBrush-github.apk`. Note that if you download a Mac OS X build, you'll need to run `xattr -d com.apple.quarantine /path/to/OpenBrush-github.app` prior to be able to launch the app, as it is not signed with Apple developer keys.

0 comments on commit a23e94f

Please sign in to comment.