diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b7789c940..ea6bac647b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \nEQ57QnLpZQy5Ft2KgPCV+PcFuPg=z+iLsAtgjx6jf0J41On79ErzFJdljmwNPvvBUEMpsdzf4E6GjFZIzpUfn1BA5livZmnmWTI3eF1V\nJ+0aIjkVfAIo0M8yhKcM1vj4+mUMhO7xZh3ipDtlnakdATvWrOBBFWLQO4rYADdkfvmIG1uLaadq\nGiTsxaXA/Vap2ffI+ECeUqtBdIwHLON4vEL6p1VKyUfbtAoafxnr9d1+kQaH0TAe60/J1Z8D6kmP\n5M/iCoWQaFq+Zo+0ACiXQikPt17lIhlwX0be+FuSa0WOwOBSnJyuzy+cpsd4ZQi724rQKbNtOx7M\nxq+FlamO+TPP26L6zIes+zfHCa/WD1+d9r1kuQ==" 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/unity-builder@v2.0-alpha-6 + 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/* diff --git a/Assets/Editor/BuildTiltBrush.cs b/Assets/Editor/BuildTiltBrush.cs index fbac3f6686..b21681c1dd 100644 --- a/Assets/Editor/BuildTiltBrush.cs +++ b/Assets/Editor/BuildTiltBrush.cs @@ -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") { diff --git a/README.md b/README.md index 3fef5b38da..4c95934e43 100644 --- a/README.md +++ b/README.md @@ -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.