From c07ae6972ea70ba726d194d245eceb2ca79054bd Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:29:20 +0100 Subject: [PATCH 01/47] Here we go again --- .github/workflows/build-macos.yml | 46 ++++++++++++++++--------------- resources/version.sh | 23 ++++++++++++---- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 1297437f..2aa05077 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -13,7 +13,7 @@ name: "macOS build" on: push: - branches: [ main ] + branches: [ enhancement/macosBuilds ] paths-ignore: - 'README.md' - 'SECURITY.md' @@ -24,7 +24,7 @@ on: - cron: '44 20 * * 1' jobs: - analyze: + build-macos: name: macOS build runs-on: macos-11 permissions: @@ -43,11 +43,11 @@ jobs: steps: - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '12.4' - + xcode-version: '12.4' + - name: Checkout repository uses: actions/checkout@v2 - with: + with: submodules: true # Initializes the CodeQL tools for scanning. @@ -66,22 +66,22 @@ jobs: # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines # and modify them (or add more) to build your code if your project # uses a compiled language - + # - name : env -# run: | -# export EVS_ACCOUNT_NAME=${{ secrets.EVS_ACCOUNT_NAME}} && export EVS_PASSWD=${{ secrets.EVS_PASSWD }} -# export CSC_LINK=${{ secrets.CSC_LINK }} && export CSC_KEY_PASSWORD=${{ secrets.CSC_KEY_PASSWORD }} -# export APPLEID=${{ secrets.APPLEID }} && export APPLEIDPASS=${{ secrets.APPLEIDPASS }} - +# run: | +# export EVS_ACCOUNT_NAME=${{ secrets.EVS_ACCOUNT_NAME}} && export EVS_PASSWD=${{ secrets.EVS_PASSWD }} +# export CSC_LINK=${{ secrets.CSC_LINK }} && export CSC_KEY_PASSWORD=${{ secrets.CSC_KEY_PASSWORD }} +# export APPLEID=${{ secrets.APPLEID }} && export APPLEIDPASS=${{ secrets.APPLEIDPASS }} + - name: Sign in to EVS run: | python3 -m pip install --upgrade castlabs-evs python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} - - - name : Build - env: + + - name : Build + env: CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} APPLEID: ${{ secrets.APPLEID }} APPLEIDPASS: ${{ secrets.APPLEIDPASS }} APPLE_ID: ${{ secrets.APPLEID }} @@ -99,23 +99,25 @@ jobs: rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown rm -r /node_modules/leveldown/node_modules/node-gyp-build || true yarn dist:universalNotWorking -p never + ls # - name: Perform CodeQL Analysis # uses: github/codeql-action/analyze@v1 - name: Add license to dmg run: | npx dmg-license resources/license.json dist/*.dmg - - - name: Import + + - name: Import uses: apple-actions/import-codesign-certs@v1 - with: + with: p12-file-base64: ${{ secrets.CSC_LINK }} p12-password: ${{ secrets.CSC_KEY_PASSWORD }} - - name: Create PKG manually - env: + # Makes the PKG + - name: Create PKG manually + env: CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} APPLEID: ${{ secrets.APPLEID }} APPLEIDPASS: ${{ secrets.APPLEIDPASS }} run: | @@ -142,7 +144,7 @@ jobs: dist/Cider.dmg dist/Cider.pkg body: signed Develop MacOS Builds - name: macOS builds + name: macOS builds tag_name: macos-beta target_commitish: ${{ env.GITHUB_SHA }} prerelease: true diff --git a/resources/version.sh b/resources/version.sh index 8184da46..55b65d3c 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,10 +1,19 @@ #!/bin/bash -LATEST_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) -SHA_DATE=$(git show -s --format=%ci $LATEST_SHA) -COMMITSINCESTABLE=$(git rev-list $LATEST_SHA..HEAD --count --since="$SHA_DATE") +printenv +# DEBUGGING +LATEST_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1) +echo $LATEST_SHA +COMMITSINCESTABLE=$(git rev-list $LATEST_SHA..HEAD --count) +echo $COMMITSINCESTABLE CURRENT_VERSION=$(node -p -e "require('./package.json').version") -if [[ $CIRCLE_BRANCH == "main" && $COMMITSINCESTABLE -gt 0 ]]; then +echo $CURRENT_VERSION +GITHUB_BASE_REF="main" +echo $GITHUB_BASE_REF + +############################################################################################# + +if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_BASE_REF == "main") && $COMMITSINCESTABLE -gt 0 ]]; then NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" else NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} @@ -17,4 +26,8 @@ else echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}" fi -echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV +if [[ -z "${GITHUB_ENV}" ]]; then + echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV +elif [[ -z "${BASH_ENV}" ]]; then + echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV +fi From 7f69515887638d0402960dd4e6f1e59345db0b4a Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:29:45 +0100 Subject: [PATCH 02/47] fuck --- .github/workflows/build-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 2aa05077..a088a249 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -13,7 +13,7 @@ name: "macOS build" on: push: - branches: [ enhancement/macosBuilds ] + branches: [ enhancement/ci ] paths-ignore: - 'README.md' - 'SECURITY.md' From 192975dd7239550facea3f100efdbd8317366aa3 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:33:23 +0100 Subject: [PATCH 03/47] gimme env --- .github/workflows/build-macos.yml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index a088a249..9560978b 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -78,6 +78,9 @@ jobs: python3 -m pip install --upgrade castlabs-evs python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} + - name: Change Version + run: sudo chmod +x resources/version.sh && ./resources/version.sh || true + - name : Build env: CSC_LINK: ${{ secrets.CSC_LINK }} @@ -137,16 +140,17 @@ jobs: dist/*.dmg dist/*.pkg # The desired behavior if no files are found using the provided path. - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: | - dist/Cider.dmg - dist/Cider.pkg - body: signed Develop MacOS Builds - name: macOS builds - tag_name: macos-beta - target_commitish: ${{ env.GITHUB_SHA }} - prerelease: true - generate_release_notes: true - fail_on_unmatched_files: false + +# - name: Release +# uses: softprops/action-gh-release@v1 +# with: +# files: | +# dist/Cider.dmg +# dist/Cider.pkg +# body: signed Develop MacOS Builds +# name: macOS builds +# tag_name: macos-beta +# target_commitish: ${{ env.GITHUB_SHA }} +# prerelease: true +# generate_release_notes: true +# fail_on_unmatched_files: false From 1d445df3b0156972ac179bd0f1955a32a3a09bea Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:38:46 +0100 Subject: [PATCH 04/47] ok --- resources/version.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index 55b65d3c..74699f8b 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,19 +1,16 @@ #!/bin/bash -printenv # DEBUGGING -LATEST_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1) +LATEST_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1 | head -n 1) echo $LATEST_SHA COMMITSINCESTABLE=$(git rev-list $LATEST_SHA..HEAD --count) echo $COMMITSINCESTABLE CURRENT_VERSION=$(node -p -e "require('./package.json').version") echo $CURRENT_VERSION -GITHUB_BASE_REF="main" -echo $GITHUB_BASE_REF ############################################################################################# -if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_BASE_REF == "main") && $COMMITSINCESTABLE -gt 0 ]]; then +if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMITSINCESTABLE -gt 0 ]]; then NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" else NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} From 2f7f8f0899aa08ec3df08dcafdb54a66639bc84d Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:42:26 +0100 Subject: [PATCH 05/47] ok2 --- .github/workflows/build-macos.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 9560978b..eabb364e 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -50,6 +50,11 @@ jobs: with: submodules: true + - name: Change Version + run: | + sudo chmod +x resources/version.sh && ./resources/version.sh || true + git remote show origin + # Initializes the CodeQL tools for scanning. # - name: Initialize CodeQL # uses: github/codeql-action/init@v1 @@ -78,9 +83,6 @@ jobs: python3 -m pip install --upgrade castlabs-evs python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} - - name: Change Version - run: sudo chmod +x resources/version.sh && ./resources/version.sh || true - - name : Build env: CSC_LINK: ${{ secrets.CSC_LINK }} From bbec1f1546de5fdb2e8680410d905cd3ef4d2701 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:46:57 +0100 Subject: [PATCH 06/47] why --- resources/version.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/version.sh b/resources/version.sh index 74699f8b..915f3bd2 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -8,6 +8,8 @@ echo $COMMITSINCESTABLE CURRENT_VERSION=$(node -p -e "require('./package.json').version") echo $CURRENT_VERSION +git log $LATEST_SHA + ############################################################################################# if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMITSINCESTABLE -gt 0 ]]; then From 462fcbf6143b07a302840c51681cefecc467344c Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:52:47 +0100 Subject: [PATCH 07/47] why github actions gotta be different --- .github/workflows/build-macos.yml | 184 +++++++++++++++--------------- resources/version.sh | 5 +- 2 files changed, 95 insertions(+), 94 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index eabb364e..bfbc7cdd 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -15,11 +15,11 @@ on: push: branches: [ enhancement/ci ] paths-ignore: - - 'README.md' - - 'SECURITY.md' - - '.gitmodules' - - '.gitignore' - - 'LICENSE' + - 'README.md' + - 'SECURITY.md' + - '.gitmodules' + - '.gitignore' + - 'LICENSE' schedule: - cron: '44 20 * * 1' @@ -41,107 +41,105 @@ jobs: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '12.4' + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '12.4' - - name: Checkout repository - uses: actions/checkout@v2 - with: - submodules: true + - name: Checkout repository + uses: actions/checkout@v2 + with: + submodules: true - - name: Change Version - run: | - sudo chmod +x resources/version.sh && ./resources/version.sh || true - git remote show origin + - name: Change Version + run: sudo chmod +x resources/version.sh && ./resources/version.sh || true - # Initializes the CodeQL tools for scanning. -# - name: Initialize CodeQL -# uses: github/codeql-action/init@v1 -# with: -# languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + # - name: Initialize CodeQL + # uses: github/codeql-action/init@v1 + # with: + # languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. # queries: ./path/to/local/query, your-org/your-repo/queries@main - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language -# - name : env -# run: | -# export EVS_ACCOUNT_NAME=${{ secrets.EVS_ACCOUNT_NAME}} && export EVS_PASSWD=${{ secrets.EVS_PASSWD }} -# export CSC_LINK=${{ secrets.CSC_LINK }} && export CSC_KEY_PASSWORD=${{ secrets.CSC_KEY_PASSWORD }} -# export APPLEID=${{ secrets.APPLEID }} && export APPLEIDPASS=${{ secrets.APPLEIDPASS }} + # - name : env + # run: | + # export EVS_ACCOUNT_NAME=${{ secrets.EVS_ACCOUNT_NAME}} && export EVS_PASSWD=${{ secrets.EVS_PASSWD }} + # export CSC_LINK=${{ secrets.CSC_LINK }} && export CSC_KEY_PASSWORD=${{ secrets.CSC_KEY_PASSWORD }} + # export APPLEID=${{ secrets.APPLEID }} && export APPLEIDPASS=${{ secrets.APPLEIDPASS }} - - name: Sign in to EVS - run: | - python3 -m pip install --upgrade castlabs-evs - python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} + - name: Sign in to EVS + run: | + python3 -m pip install --upgrade castlabs-evs + python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} - - name : Build - env: - CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} - APPLEID: ${{ secrets.APPLEID }} - APPLEIDPASS: ${{ secrets.APPLEIDPASS }} - APPLE_ID: ${{ secrets.APPLEID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLEIDPASS }} - PSC_NAME: ${{ secrets.PSC_NAME }} - DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer - run: | - rm cider-yarn.lock || true - xcodebuild -version - brew install autoconf automake libtool - yarn install - cp resources/verror-types node_modules/@types/verror/index.d.ts - cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js - rm -r node_modules/pouchdb-node/node_modules/leveldown - rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown - rm -r /node_modules/leveldown/node_modules/node-gyp-build || true - yarn dist:universalNotWorking -p never - ls -# - name: Perform CodeQL Analysis -# uses: github/codeql-action/analyze@v1 + - name: Build + env: + CSC_LINK: ${{ secrets.CSC_LINK }} + CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + APPLEID: ${{ secrets.APPLEID }} + APPLEIDPASS: ${{ secrets.APPLEIDPASS }} + APPLE_ID: ${{ secrets.APPLEID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLEIDPASS }} + PSC_NAME: ${{ secrets.PSC_NAME }} + DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer + run: | + rm cider-yarn.lock || true + xcodebuild -version + brew install autoconf automake libtool + yarn install + cp resources/verror-types node_modules/@types/verror/index.d.ts + cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js + rm -r node_modules/pouchdb-node/node_modules/leveldown + rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown + rm -r /node_modules/leveldown/node_modules/node-gyp-build || true + yarn dist:universalNotWorking -p never + ls + # - name: Perform CodeQL Analysis + # uses: github/codeql-action/analyze@v1 - - name: Add license to dmg - run: | - npx dmg-license resources/license.json dist/*.dmg + - name: Add license to dmg + run: | + npx dmg-license resources/license.json dist/*.dmg - - name: Import - uses: apple-actions/import-codesign-certs@v1 - with: - p12-file-base64: ${{ secrets.CSC_LINK }} - p12-password: ${{ secrets.CSC_KEY_PASSWORD }} + - name: Import + uses: apple-actions/import-codesign-certs@v1 + with: + p12-file-base64: ${{ secrets.CSC_LINK }} + p12-password: ${{ secrets.CSC_KEY_PASSWORD }} - # Makes the PKG - - name: Create PKG manually - env: - CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} - APPLEID: ${{ secrets.APPLEID }} - APPLEIDPASS: ${{ secrets.APPLEIDPASS }} - run: | - pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider.pkg --sign ${{ secrets.PSC_NAME }} - xcrun altool --notarize-app --primary-bundle-id com.ciderapp.cider -f dist/Cider.pkg --username ${{ secrets.APPLEID }} --password ${{ secrets.APPLEIDPASS }} - sleep 5m - xcrun stapler staple dist/Cider.pkg || true - mv dist/*.dmg dist/Cider.dmg + # Makes the PKG + - name: Create PKG manually + env: + CSC_LINK: ${{ secrets.CSC_LINK }} + CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + APPLEID: ${{ secrets.APPLEID }} + APPLEIDPASS: ${{ secrets.APPLEIDPASS }} + run: | + pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider.pkg --sign ${{ secrets.PSC_NAME }} + xcrun altool --notarize-app --primary-bundle-id com.ciderapp.cider -f dist/Cider.pkg --username ${{ secrets.APPLEID }} --password ${{ secrets.APPLEIDPASS }} + sleep 5m + xcrun stapler staple dist/Cider.pkg || true + mv dist/*.dmg dist/Cider.dmg - - name: Upload a Build Artifact - uses: actions/upload-artifact@v2.2.3 - with: - # Artifact name - name: macOS - # A file, directory or wildcard pattern that describes what to upload - path: | - dist/*.dmg - dist/*.pkg - # The desired behavior if no files are found using the provided path. + - name: Upload a Build Artifact + uses: actions/upload-artifact@v2.2.3 + with: + # Artifact name + name: macOS + # A file, directory or wildcard pattern that describes what to upload + path: | + dist/*.dmg + dist/*.pkg + # The desired behavior if no files are found using the provided path. # - name: Release # uses: softprops/action-gh-release@v1 diff --git a/resources/version.sh b/resources/version.sh index 915f3bd2..2d36c60b 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,6 +1,10 @@ #!/bin/bash # DEBUGGING +curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable + +# | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1 | head -n 1 + LATEST_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1 | head -n 1) echo $LATEST_SHA COMMITSINCESTABLE=$(git rev-list $LATEST_SHA..HEAD --count) @@ -8,7 +12,6 @@ echo $COMMITSINCESTABLE CURRENT_VERSION=$(node -p -e "require('./package.json').version") echo $CURRENT_VERSION -git log $LATEST_SHA ############################################################################################# From b0718e6247fdef6fdb0c3acab8c02d698d843a28 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:56:49 +0100 Subject: [PATCH 08/47] s --- resources/version.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index 2d36c60b..47e84eed 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,13 +1,12 @@ #!/bin/bash + +git rev-list origin..HEAD + # DEBUGGING -curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable - -# | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1 | head -n 1 - LATEST_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1 | head -n 1) echo $LATEST_SHA -COMMITSINCESTABLE=$(git rev-list $LATEST_SHA..HEAD --count) +COMMITSINCESTABLE=$(git rev-list 099e41264817ead26607e4552317488378146d0e..HEAD --count) echo $COMMITSINCESTABLE CURRENT_VERSION=$(node -p -e "require('./package.json').version") echo $CURRENT_VERSION From 4303477fa5866a50a5499523efd8cffe3eab9e2e Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 15:06:10 +0100 Subject: [PATCH 09/47] PLEASEEEE --- resources/version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index 47e84eed..da3b2dfc 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -4,9 +4,9 @@ git rev-list origin..HEAD # DEBUGGING -LATEST_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1 | head -n 1) -echo $LATEST_SHA -COMMITSINCESTABLE=$(git rev-list 099e41264817ead26607e4552317488378146d0e..HEAD --count) +STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1 | head -n 1) +echo $STABLE_SHA +COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..$GITHUB_SHA --count) echo $COMMITSINCESTABLE CURRENT_VERSION=$(node -p -e "require('./package.json').version") echo $CURRENT_VERSION From 6221a9c5205baebc04739110bcfe85220e895004 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 15:08:05 +0100 Subject: [PATCH 10/47] stop plesssssssssss --- resources/version.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index da3b2dfc..c9ca6955 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,16 +1,11 @@ #!/bin/bash - -git rev-list origin..HEAD - # DEBUGGING STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1 | head -n 1) -echo $STABLE_SHA COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..$GITHUB_SHA --count) -echo $COMMITSINCESTABLE CURRENT_VERSION=$(node -p -e "require('./package.json').version") -echo $CURRENT_VERSION +git rev-list --count ############################################################################################# From f66a3e78cb65178bbe34dd769e9cb1aff921db12 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 15:09:20 +0100 Subject: [PATCH 11/47] shit --- resources/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/version.sh b/resources/version.sh index c9ca6955..1e5dadb5 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -5,7 +5,7 @@ STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..$GITHUB_SHA --count) CURRENT_VERSION=$(node -p -e "require('./package.json').version") -git rev-list --count +git rev-list --all --count ############################################################################################# From 9255d0c11e84fb85229ea0c9e0d6304685699fc0 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Mon, 1 Aug 2022 15:16:14 +0100 Subject: [PATCH 12/47] agaiun --- .github/workflows/build-macos.yml | 1 + resources/version.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index bfbc7cdd..a146cbba 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -48,6 +48,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 with: + ref: ${{ github.sha }} submodules: true - name: Change Version diff --git a/resources/version.sh b/resources/version.sh index 1e5dadb5..45fbd8b1 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -5,7 +5,7 @@ STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..$GITHUB_SHA --count) CURRENT_VERSION=$(node -p -e "require('./package.json').version") -git rev-list --all --count +git rev-list --all ############################################################################################# From d7bd15cf6b87fd7ca89a54b7eec0a8dd663c20b7 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:19:15 +0100 Subject: [PATCH 13/47] Removed the checkout shit --- .github/workflows/build-macos.yml | 6 ------ resources/version.sh | 13 ++++--------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index a146cbba..b3904ee2 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -45,12 +45,6 @@ jobs: with: xcode-version: '12.4' - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.sha }} - submodules: true - - name: Change Version run: sudo chmod +x resources/version.sh && ./resources/version.sh || true diff --git a/resources/version.sh b/resources/version.sh index 45fbd8b1..6a895302 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,14 +1,9 @@ #!/bin/bash -# DEBUGGING -STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep sha | cut -d '"' -f 4 | sed 's/v//' | xargs | cut -d' ' -f1 | head -n 1) -COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..$GITHUB_SHA --count) +STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) +SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) +COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") CURRENT_VERSION=$(node -p -e "require('./package.json').version") - -git rev-list --all - -############################################################################################# - if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMITSINCESTABLE -gt 0 ]]; then NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" else @@ -26,4 +21,4 @@ if [[ -z "${GITHUB_ENV}" ]]; then echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV elif [[ -z "${BASH_ENV}" ]]; then echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV -fi +fi \ No newline at end of file From 4b299b032b033e35ec57d9e01518fb26d3b6b742 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:21:26 +0100 Subject: [PATCH 14/47] Added it back and bumped it --- .github/workflows/build-macos.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index b3904ee2..4b60942f 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -45,6 +45,10 @@ jobs: with: xcode-version: '12.4' + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Change Version run: sudo chmod +x resources/version.sh && ./resources/version.sh || true From 838ce7efcb0e4b008a9e23b29c7f5d5b997d9c6e Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:25:17 +0100 Subject: [PATCH 15/47] Updated version.sh --- resources/version.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index 6a895302..c5c51b42 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,17 +1,19 @@ #!/bin/bash +printenv + STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") CURRENT_VERSION=$(node -p -e "require('./package.json').version") -if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMITSINCESTABLE -gt 0 ]]; then +if [[ ($CIRCLE_BRANCH != "stable" && $GITHUB_REF_NAME != "stable") && $COMMITSINCESTABLE -gt 0 ]]; then NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" else NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} fi +echo "Version: $NEW_VERSION" if [[ $COMMITSINCESTABLE -gt 0 ]]; then - echo "Version: $NEW_VERSION" sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json else echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}" @@ -21,4 +23,4 @@ if [[ -z "${GITHUB_ENV}" ]]; then echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV elif [[ -z "${BASH_ENV}" ]]; then echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV -fi \ No newline at end of file +fi From 5a921b0be4dce8d8008676bd91785b054bc3faa6 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:27:11 +0100 Subject: [PATCH 16/47] Updated version.sh --- resources/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/version.sh b/resources/version.sh index c5c51b42..d94dfa60 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -12,7 +12,7 @@ else NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} fi echo "Version: $NEW_VERSION" - +echo "Current version: $CURRENT_VERSION" if [[ $COMMITSINCESTABLE -gt 0 ]]; then sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json else From dbef4daade833d9766b7e1064f3bd5c77c4f2a1f Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:34:04 +0100 Subject: [PATCH 17/47] Comments and echos --- resources/version.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index d94dfa60..5b029334 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,16 +1,19 @@ #!/bin/bash -printenv - STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") CURRENT_VERSION=$(node -p -e "require('./package.json').version") + +# Make the version number if [[ ($CIRCLE_BRANCH != "stable" && $GITHUB_REF_NAME != "stable") && $COMMITSINCESTABLE -gt 0 ]]; then + echo "This is not a stable branch, but there are commits since the last stable release. Setting beta version." NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" else + echo "This is a stable branch. Setting stable version." NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} fi + echo "Version: $NEW_VERSION" echo "Current version: $CURRENT_VERSION" if [[ $COMMITSINCESTABLE -gt 0 ]]; then @@ -19,6 +22,7 @@ else echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}" fi +# Make it a environment variable if [[ -z "${GITHUB_ENV}" ]]; then echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV elif [[ -z "${BASH_ENV}" ]]; then From 36786ec8cc332cde63fbf06381d5435ca440d08a Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:36:49 +0100 Subject: [PATCH 18/47] Why is this not working --- resources/version.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/version.sh b/resources/version.sh index 5b029334..5134c908 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -17,6 +17,9 @@ fi echo "Version: $NEW_VERSION" echo "Current version: $CURRENT_VERSION" if [[ $COMMITSINCESTABLE -gt 0 ]]; then + ls + echo "THE COMMAND THAT IS RUNNING IS:" + echo "sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json" sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json else echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}" From 52fc9d2d46f7b191306eaab48f8fb5b0230e9303 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:39:26 +0100 Subject: [PATCH 19/47] Or maybe it is --- resources/version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index 5134c908..1821f800 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -17,9 +17,6 @@ fi echo "Version: $NEW_VERSION" echo "Current version: $CURRENT_VERSION" if [[ $COMMITSINCESTABLE -gt 0 ]]; then - ls - echo "THE COMMAND THAT IS RUNNING IS:" - echo "sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json" sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json else echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}" @@ -31,3 +28,6 @@ if [[ -z "${GITHUB_ENV}" ]]; then elif [[ -z "${BASH_ENV}" ]]; then echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV fi + + +node -p -e "require('./package.json').version" \ No newline at end of file From c114273b2f86f1402d2ef9763d9c5b9cfa528a86 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:42:27 +0100 Subject: [PATCH 20/47] AGAIN! --- resources/version.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index 1821f800..372434e0 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -6,12 +6,12 @@ COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") CURRENT_VERSION=$(node -p -e "require('./package.json').version") # Make the version number -if [[ ($CIRCLE_BRANCH != "stable" && $GITHUB_REF_NAME != "stable") && $COMMITSINCESTABLE -gt 0 ]]; then - echo "This is not a stable branch, but there are commits since the last stable release. Setting beta version." - NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" -else +if [[ $CIRCLE_BRANCH == "stable" || $GITHUB_REF_NAME == "stable" ]]; then echo "This is a stable branch. Setting stable version." NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} +else + echo "This is not a stable branch, but there are commits since the last stable release. Setting beta version." + NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" fi echo "Version: $NEW_VERSION" @@ -29,5 +29,4 @@ elif [[ -z "${BASH_ENV}" ]]; then echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV fi - -node -p -e "require('./package.json').version" \ No newline at end of file +node -p -e "require('./package.json').version" From 81ff59d5dd6e3048d25a380e0d9f8030d778d6f4 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:49:06 +0100 Subject: [PATCH 21/47] macos just gotta be weird with sed --- resources/version.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/version.sh b/resources/version.sh index 372434e0..1c217aac 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -17,7 +17,11 @@ fi echo "Version: $NEW_VERSION" echo "Current version: $CURRENT_VERSION" if [[ $COMMITSINCESTABLE -gt 0 ]]; then - sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json + if [[ $RUNNER_OS == "macOS" ]]; then + sed -i "" -e "s/$CURRENT_VERSION/$NEW_VERSION/" package.json + else + sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json + fi else echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}" fi From 7ef54ecad640047d2c593ed16184ec2f1cebd2d2 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:50:38 +0100 Subject: [PATCH 22/47] YES! --- resources/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/version.sh b/resources/version.sh index 1c217aac..054a7f78 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -9,7 +9,7 @@ CURRENT_VERSION=$(node -p -e "require('./package.json').version") if [[ $CIRCLE_BRANCH == "stable" || $GITHUB_REF_NAME == "stable" ]]; then echo "This is a stable branch. Setting stable version." NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} -else +elif [[ $COMMITSINCESTABLE -gt 0 ]]; then echo "This is not a stable branch, but there are commits since the last stable release. Setting beta version." NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" fi From b4f02fddfed83df1bfed6800e9b2ede621958b1a Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 17:12:17 +0100 Subject: [PATCH 23/47] Testing --- .github/workflows/build-macos.yml | 62 +++++-------------------------- resources/version.sh | 1 + 2 files changed, 11 insertions(+), 52 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 4b60942f..c355d6f2 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -1,14 +1,3 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# name: "macOS build" on: @@ -36,9 +25,6 @@ jobs: fail-fast: false matrix: language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - uses: maxim-lobanov/setup-xcode@v1 @@ -52,29 +38,6 @@ jobs: - name: Change Version run: sudo chmod +x resources/version.sh && ./resources/version.sh || true - # Initializes the CodeQL tools for scanning. - # - name: Initialize CodeQL - # uses: github/codeql-action/init@v1 - # with: - # languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - # - name : env - # run: | - # export EVS_ACCOUNT_NAME=${{ secrets.EVS_ACCOUNT_NAME}} && export EVS_PASSWD=${{ secrets.EVS_PASSWD }} - # export CSC_LINK=${{ secrets.CSC_LINK }} && export CSC_KEY_PASSWORD=${{ secrets.CSC_KEY_PASSWORD }} - # export APPLEID=${{ secrets.APPLEID }} && export APPLEIDPASS=${{ secrets.APPLEIDPASS }} - - name: Sign in to EVS run: | python3 -m pip install --upgrade castlabs-evs @@ -102,8 +65,6 @@ jobs: rm -r /node_modules/leveldown/node_modules/node-gyp-build || true yarn dist:universalNotWorking -p never ls - # - name: Perform CodeQL Analysis - # uses: github/codeql-action/analyze@v1 - name: Add license to dmg run: | @@ -140,16 +101,13 @@ jobs: dist/*.pkg # The desired behavior if no files are found using the provided path. -# - name: Release -# uses: softprops/action-gh-release@v1 -# with: -# files: | -# dist/Cider.dmg -# dist/Cider.pkg -# body: signed Develop MacOS Builds -# name: macOS builds -# tag_name: macos-beta -# target_commitish: ${{ env.GITHUB_SHA }} -# prerelease: true -# generate_release_notes: true -# fail_on_unmatched_files: false +# - name: Upload Artifacts to Latest Release +# uses: softprops/action-gh-release@v1 +# with: +# token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} +# files: | +# dist/*.dmg +# dist/*.pkg +# tag_name: $APP_VERSION +# env: +# GITHUB_REPOSITORY: ciderapp/cider-releases \ No newline at end of file diff --git a/resources/version.sh b/resources/version.sh index 054a7f78..cdb382fe 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -34,3 +34,4 @@ elif [[ -z "${BASH_ENV}" ]]; then fi node -p -e "require('./package.json').version" +printenv \ No newline at end of file From 0fafb1ac0eb8f99bc13e102029c28ad2d9287cc4 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:02:28 +0100 Subject: [PATCH 24/47] Okay --- .github/workflows/build-macos.yml | 49 +++++++++++++++---------------- resources/version.sh | 8 ++--- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index c355d6f2..3c7bf4a4 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -43,6 +43,22 @@ jobs: python3 -m pip install --upgrade castlabs-evs python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} + - name: Setup Environment + run: | + xcodebuild -version + brew install autoconf automake libtool + + - name: Install Node Modules + run: | + yarn install + cp resources/verror-types node_modules/@types/verror/index.d.ts + cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js + rm -r node_modules/pouchdb-node/node_modules/leveldown + rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown + rm -r /node_modules/leveldown/node_modules/node-gyp-build || true + + + # Build the DMG - name: Build env: CSC_LINK: ${{ secrets.CSC_LINK }} @@ -53,20 +69,9 @@ jobs: APPLE_ID_PASSWORD: ${{ secrets.APPLEIDPASS }} PSC_NAME: ${{ secrets.PSC_NAME }} DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer - run: | - rm cider-yarn.lock || true - xcodebuild -version - brew install autoconf automake libtool - yarn install - cp resources/verror-types node_modules/@types/verror/index.d.ts - cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js - rm -r node_modules/pouchdb-node/node_modules/leveldown - rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown - rm -r /node_modules/leveldown/node_modules/node-gyp-build || true - yarn dist:universalNotWorking -p never - ls + run: yarn dist:universalNotWorking -p never - - name: Add license to dmg + - name: Add license to DMG run: | npx dmg-license resources/license.json dist/*.dmg @@ -76,7 +81,7 @@ jobs: p12-file-base64: ${{ secrets.CSC_LINK }} p12-password: ${{ secrets.CSC_KEY_PASSWORD }} - # Makes the PKG + # Build to PKG - name: Create PKG manually env: CSC_LINK: ${{ secrets.CSC_LINK }} @@ -84,22 +89,16 @@ jobs: APPLEID: ${{ secrets.APPLEID }} APPLEIDPASS: ${{ secrets.APPLEIDPASS }} run: | - pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider.pkg --sign ${{ secrets.PSC_NAME }} - xcrun altool --notarize-app --primary-bundle-id com.ciderapp.cider -f dist/Cider.pkg --username ${{ secrets.APPLEID }} --password ${{ secrets.APPLEIDPASS }} + pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider-$APP_VERSION-universal.pkg --sign ${{ secrets.PSC_NAME }} + xcrun altool --notarize-app --primary-bundle-id com.ciderapp.cider -f dist/Cider*.pkg --username ${{ secrets.APPLEID }} --password ${{ secrets.APPLEIDPASS }} sleep 5m - xcrun stapler staple dist/Cider.pkg || true - mv dist/*.dmg dist/Cider.dmg + xcrun stapler staple dist/Cider*.pkg || true - name: Upload a Build Artifact uses: actions/upload-artifact@v2.2.3 with: - # Artifact name - name: macOS - # A file, directory or wildcard pattern that describes what to upload - path: | - dist/*.dmg - dist/*.pkg - # The desired behavior if no files are found using the provided path. + name: Cider-macOS-$APP_VERSION + path: dist/* # - name: Upload Artifacts to Latest Release # uses: softprops/action-gh-release@v1 diff --git a/resources/version.sh b/resources/version.sh index cdb382fe..4f4f3ac8 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -27,10 +27,10 @@ else fi # Make it a environment variable -if [[ -z "${GITHUB_ENV}" ]]; then - echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV -elif [[ -z "${BASH_ENV}" ]]; then - echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV +if [[ -z "${GITHUB_REF}" ]]; then + echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >> $GITHUB_ENV +else + echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >> $BASH_ENV fi node -p -e "require('./package.json').version" From 69df95f74accbda400e905a80640f8be840f643a Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:18:54 +0100 Subject: [PATCH 25/47] Update --- .github/workflows/build-macos.yml | 4 ++-- resources/version.sh | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 3c7bf4a4..1c0a9161 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -59,7 +59,7 @@ jobs: # Build the DMG - - name: Build + - name: Build the DMG env: CSC_LINK: ${{ secrets.CSC_LINK }} CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} @@ -82,7 +82,7 @@ jobs: p12-password: ${{ secrets.CSC_KEY_PASSWORD }} # Build to PKG - - name: Create PKG manually + - name: Build the PKG env: CSC_LINK: ${{ secrets.CSC_LINK }} CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} diff --git a/resources/version.sh b/resources/version.sh index 4f4f3ac8..c11957f5 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -26,11 +26,10 @@ else echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}" fi -# Make it a environment variable -if [[ -z "${GITHUB_REF}" ]]; then - echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >> $GITHUB_ENV +if [[ $GITHUB_REF_NAME != "" ]]; then + echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV else - echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >> $BASH_ENV + echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV fi node -p -e "require('./package.json').version" From 9949ba87cd81851fca92d689cb8358803d69221a Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:31:13 +0100 Subject: [PATCH 26/47] Removed cron, renamed some steps, debugging version.sh --- .github/workflows/build-macos.yml | 18 +++++++----------- resources/version.sh | 2 ++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 1c0a9161..55c2f703 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -9,12 +9,11 @@ on: - '.gitmodules' - '.gitignore' - 'LICENSE' - schedule: - - cron: '44 20 * * 1' + - 'cider.lock' jobs: build-macos: - name: macOS build + name: build-macos runs-on: macos-11 permissions: actions: read @@ -44,11 +43,9 @@ jobs: python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} - name: Setup Environment - run: | - xcodebuild -version - brew install autoconf automake libtool + run: brew install autoconf automake libtool - - name: Install Node Modules + - name: Install and Configure Node Modules run: | yarn install cp resources/verror-types node_modules/@types/verror/index.d.ts @@ -72,8 +69,7 @@ jobs: run: yarn dist:universalNotWorking -p never - name: Add license to DMG - run: | - npx dmg-license resources/license.json dist/*.dmg + run: npx dmg-license resources/license.json dist/*.dmg - name: Import uses: apple-actions/import-codesign-certs@v1 @@ -89,7 +85,7 @@ jobs: APPLEID: ${{ secrets.APPLEID }} APPLEIDPASS: ${{ secrets.APPLEIDPASS }} run: | - pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider-$APP_VERSION-universal.pkg --sign ${{ secrets.PSC_NAME }} + pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider-${{ env.APP_VERSION }}-universal.pkg --sign ${{ secrets.PSC_NAME }} xcrun altool --notarize-app --primary-bundle-id com.ciderapp.cider -f dist/Cider*.pkg --username ${{ secrets.APPLEID }} --password ${{ secrets.APPLEIDPASS }} sleep 5m xcrun stapler staple dist/Cider*.pkg || true @@ -97,7 +93,7 @@ jobs: - name: Upload a Build Artifact uses: actions/upload-artifact@v2.2.3 with: - name: Cider-macOS-$APP_VERSION + name: Cider-macOS-${{ env.APP_VERSION }} path: dist/* # - name: Upload Artifacts to Latest Release diff --git a/resources/version.sh b/resources/version.sh index c11957f5..12928ad5 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -5,6 +5,8 @@ SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") CURRENT_VERSION=$(node -p -e "require('./package.json').version") +echo "Commits since stable: $COMMITSINCESTABLE" + # Make the version number if [[ $CIRCLE_BRANCH == "stable" || $GITHUB_REF_NAME == "stable" ]]; then echo "This is a stable branch. Setting stable version." From 4a32015e24ba29b7165175bce1460a938e1e392d Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:53:12 +0100 Subject: [PATCH 27/47] PLSPLSPLSPLSPLSPLSPLSPLPSLPLS WORK --- .github/workflows/build-macos.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 55c2f703..2dce8491 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -52,7 +52,6 @@ jobs: cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js rm -r node_modules/pouchdb-node/node_modules/leveldown rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown - rm -r /node_modules/leveldown/node_modules/node-gyp-build || true # Build the DMG @@ -94,15 +93,19 @@ jobs: uses: actions/upload-artifact@v2.2.3 with: name: Cider-macOS-${{ env.APP_VERSION }} - path: dist/* + path: | + dist/*.dmg + dist/*.pkg + latest-mac.yml -# - name: Upload Artifacts to Latest Release -# uses: softprops/action-gh-release@v1 -# with: -# token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} -# files: | -# dist/*.dmg -# dist/*.pkg -# tag_name: $APP_VERSION -# env: -# GITHUB_REPOSITORY: ciderapp/cider-releases \ No newline at end of file + - name: Upload Artifacts to Latest Release + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.RELEASE_TOKEN }} + files: | + dist/*.dmg + dist/*.pkg + latest-mac.yml + tag_name: ${{ env.APP_VERSION }} + env: + GITHUB_REPOSITORY: ciderapp/cider-releases \ No newline at end of file From 7205fe81748d3a68bb35f3fada8b8c71f8aaf331 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:54:03 +0100 Subject: [PATCH 28/47] PLSPLSPLSPLSPLSPLSPLSPLPSLPLS WORK 2 --- .github/workflows/build-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 2dce8491..911cc185 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -106,6 +106,6 @@ jobs: dist/*.dmg dist/*.pkg latest-mac.yml - tag_name: ${{ env.APP_VERSION }} + tag_name: v${{ env.APP_VERSION }} env: GITHUB_REPOSITORY: ciderapp/cider-releases \ No newline at end of file From 310db526a5b90ba1b8181c9f602e89bc3ed87cd3 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 19:56:37 +0100 Subject: [PATCH 29/47] Appending test --- .github/workflows/build-macos.yml | 17 +++++++++++------ resources/version.sh | 3 ++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 911cc185..3c90ef96 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -43,7 +43,7 @@ jobs: python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} - name: Setup Environment - run: brew install autoconf automake libtool + run: brew install automake #libtool autoconf - name: Install and Configure Node Modules run: | @@ -96,16 +96,21 @@ jobs: path: | dist/*.dmg dist/*.pkg - latest-mac.yml + dist/latest-mac.yml - name: Upload Artifacts to Latest Release uses: softprops/action-gh-release@v1 + env: + GITHUB_REPOSITORY: ciderapp/cider-releases + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - token: ${{ secrets.RELEASE_TOKEN }} + repository: ciderapp/cider-releases + token: ${{ secrets.GITHUB_TOKEN }} + append_body: false files: | dist/*.dmg dist/*.pkg - latest-mac.yml + dist/latest-mac.yml tag_name: v${{ env.APP_VERSION }} - env: - GITHUB_REPOSITORY: ciderapp/cider-releases \ No newline at end of file + title: Cider Version ${{ env.APP_VERSION }} (${{ env.GITHUB_REF_NAME }}) + body: Full changelog available [here](https://github.com/ciderapp/Cider/compare/stable...main) \ No newline at end of file diff --git a/resources/version.sh b/resources/version.sh index 12928ad5..1129bb95 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -2,7 +2,8 @@ STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) -COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") +#COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") +COMMITSINCESTABLE=9 CURRENT_VERSION=$(node -p -e "require('./package.json').version") echo "Commits since stable: $COMMITSINCESTABLE" From b4b32f9e2c17649285e32a469b30ea43c7ae1f3d Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 20:20:55 +0100 Subject: [PATCH 30/47] Appending test 2 --- .github/workflows/build-macos.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 3c90ef96..0b3d3cfe 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -100,17 +100,19 @@ jobs: - name: Upload Artifacts to Latest Release uses: softprops/action-gh-release@v1 - env: - GITHUB_REPOSITORY: ciderapp/cider-releases - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - repository: ciderapp/cider-releases - token: ${{ secrets.GITHUB_TOKEN }} - append_body: false + body: Full changelog available [here](https://github.com/ciderapp/Cider/compare/stable...main) files: | dist/*.dmg dist/*.pkg dist/latest-mac.yml + name: Cider Version ${{ env.APP_VERSION }} (${{ env.GITHUB_REF_NAME }}) tag_name: v${{ env.APP_VERSION }} - title: Cider Version ${{ env.APP_VERSION }} (${{ env.GITHUB_REF_NAME }}) - body: Full changelog available [here](https://github.com/ciderapp/Cider/compare/stable...main) \ No newline at end of file + repository: ciderapp/cider-releases + token: ${{ secrets.GITHUB_TOKEN }} + env: + GITHUB_REPOSITORY: ciderapp/cider-releases + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + From 0fc628c57c3080876869cdb8240633812654a9cc Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 20:35:43 +0100 Subject: [PATCH 31/47] bad --- .github/workflows/build-macos.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 0b3d3cfe..12a14f0f 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -11,6 +11,9 @@ on: - 'LICENSE' - 'cider.lock' +permissions: + contents: write + jobs: build-macos: name: build-macos From 36b78ecade7795e74a9aff0e73e77c2ba690b0bc Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 20:36:40 +0100 Subject: [PATCH 32/47] cba to wait 4 hours for this shit --- .github/workflows/build-macos.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 12a14f0f..bcd2ce90 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -80,17 +80,17 @@ jobs: p12-password: ${{ secrets.CSC_KEY_PASSWORD }} # Build to PKG - - name: Build the PKG - env: - CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} - APPLEID: ${{ secrets.APPLEID }} - APPLEIDPASS: ${{ secrets.APPLEIDPASS }} - run: | - pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider-${{ env.APP_VERSION }}-universal.pkg --sign ${{ secrets.PSC_NAME }} - xcrun altool --notarize-app --primary-bundle-id com.ciderapp.cider -f dist/Cider*.pkg --username ${{ secrets.APPLEID }} --password ${{ secrets.APPLEIDPASS }} - sleep 5m - xcrun stapler staple dist/Cider*.pkg || true +# - name: Build the PKG +# env: +# CSC_LINK: ${{ secrets.CSC_LINK }} +# CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} +# APPLEID: ${{ secrets.APPLEID }} +# APPLEIDPASS: ${{ secrets.APPLEIDPASS }} +# run: | +# pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider-${{ env.APP_VERSION }}-universal.pkg --sign ${{ secrets.PSC_NAME }} +# xcrun altool --notarize-app --primary-bundle-id com.ciderapp.cider -f dist/Cider*.pkg --username ${{ secrets.APPLEID }} --password ${{ secrets.APPLEIDPASS }} +# sleep 5m +# xcrun stapler staple dist/Cider*.pkg || true - name: Upload a Build Artifact uses: actions/upload-artifact@v2.2.3 @@ -98,7 +98,6 @@ jobs: name: Cider-macOS-${{ env.APP_VERSION }} path: | dist/*.dmg - dist/*.pkg dist/latest-mac.yml - name: Upload Artifacts to Latest Release @@ -107,7 +106,6 @@ jobs: body: Full changelog available [here](https://github.com/ciderapp/Cider/compare/stable...main) files: | dist/*.dmg - dist/*.pkg dist/latest-mac.yml name: Cider Version ${{ env.APP_VERSION }} (${{ env.GITHUB_REF_NAME }}) tag_name: v${{ env.APP_VERSION }} From e1b95c1c2a96b51a212fe524d525a21a621cb926 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 20:59:38 +0100 Subject: [PATCH 33/47] does this work --- .github/workflows/build-macos.yml | 35 +++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index bcd2ce90..445d1ea4 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -100,20 +100,33 @@ jobs: dist/*.dmg dist/latest-mac.yml - - name: Upload Artifacts to Latest Release - uses: softprops/action-gh-release@v1 + - name: Upload files to release + uses: svenstaro/upload-release-action@v2 with: - body: Full changelog available [here](https://github.com/ciderapp/Cider/compare/stable...main) - files: | + repo_name: ciderapp/cider-releases + # A personal access token for the GitHub repository in which the release will be created and edited. + # It is recommended to create the access token with the following scopes: `repo, user, admin:repo_hook`. + repo_token: ${{ secrets.RELEASE_TOKEN }} + file_glob: true + file: | dist/*.dmg dist/latest-mac.yml - name: Cider Version ${{ env.APP_VERSION }} (${{ env.GITHUB_REF_NAME }}) - tag_name: v${{ env.APP_VERSION }} - repository: ciderapp/cider-releases - token: ${{ secrets.GITHUB_TOKEN }} - env: - GITHUB_REPOSITORY: ciderapp/cider-releases - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag: v${{ env.APP_VERSION }} + +# - name: Upload Artifacts to Latest Release +# uses: softprops/action-gh-release@v1 +# with: +# body: Full changelog available [here](https://github.com/ciderapp/Cider/compare/stable...main) +# files: | +# dist/*.dmg +# dist/latest-mac.yml +# name: Cider Version ${{ env.APP_VERSION }} (${{ env.GITHUB_REF_NAME }}) +# tag_name: v${{ env.APP_VERSION }} +# repository: ciderapp/cider-releases +# token: ${{ secrets.RELEASE_TOKEN }} +# env: +# GITHUB_REPOSITORY: ciderapp/cider-releases +# GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} From 86fc343dbaa439dcde5ba1bd1bdacfa60d647bf9 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 21:14:59 +0100 Subject: [PATCH 34/47] pls --- .github/workflows/build-macos.yml | 95 +++++++++++++++---------------- 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 445d1ea4..f5e4d274 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -40,44 +40,46 @@ jobs: - name: Change Version run: sudo chmod +x resources/version.sh && ./resources/version.sh || true - - name: Sign in to EVS - run: | - python3 -m pip install --upgrade castlabs-evs - python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} + - run: echo "test" > test.md - - name: Setup Environment - run: brew install automake #libtool autoconf - - - name: Install and Configure Node Modules - run: | - yarn install - cp resources/verror-types node_modules/@types/verror/index.d.ts - cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js - rm -r node_modules/pouchdb-node/node_modules/leveldown - rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown - - - # Build the DMG - - name: Build the DMG - env: - CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} - APPLEID: ${{ secrets.APPLEID }} - APPLEIDPASS: ${{ secrets.APPLEIDPASS }} - APPLE_ID: ${{ secrets.APPLEID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLEIDPASS }} - PSC_NAME: ${{ secrets.PSC_NAME }} - DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer - run: yarn dist:universalNotWorking -p never - - - name: Add license to DMG - run: npx dmg-license resources/license.json dist/*.dmg - - - name: Import - uses: apple-actions/import-codesign-certs@v1 - with: - p12-file-base64: ${{ secrets.CSC_LINK }} - p12-password: ${{ secrets.CSC_KEY_PASSWORD }} +# - name: Sign in to EVS +# run: | +# python3 -m pip install --upgrade castlabs-evs +# python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} +# +# - name: Setup Environment +# run: brew install automake #libtool autoconf +# +# - name: Install and Configure Node Modules +# run: | +# yarn install +# cp resources/verror-types node_modules/@types/verror/index.d.ts +# cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js +# rm -r node_modules/pouchdb-node/node_modules/leveldown +# rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown +# +# +# # Build the DMG +# - name: Build the DMG +# env: +# CSC_LINK: ${{ secrets.CSC_LINK }} +# CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} +# APPLEID: ${{ secrets.APPLEID }} +# APPLEIDPASS: ${{ secrets.APPLEIDPASS }} +# APPLE_ID: ${{ secrets.APPLEID }} +# APPLE_ID_PASSWORD: ${{ secrets.APPLEIDPASS }} +# PSC_NAME: ${{ secrets.PSC_NAME }} +# DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer +# run: yarn dist:universalNotWorking -p never +# +# - name: Add license to DMG +# run: npx dmg-license resources/license.json dist/*.dmg +# +# - name: Import +# uses: apple-actions/import-codesign-certs@v1 +# with: +# p12-file-base64: ${{ secrets.CSC_LINK }} +# p12-password: ${{ secrets.CSC_KEY_PASSWORD }} # Build to PKG # - name: Build the PKG @@ -92,13 +94,13 @@ jobs: # sleep 5m # xcrun stapler staple dist/Cider*.pkg || true - - name: Upload a Build Artifact - uses: actions/upload-artifact@v2.2.3 - with: - name: Cider-macOS-${{ env.APP_VERSION }} - path: | - dist/*.dmg - dist/latest-mac.yml +# - name: Upload a Build Artifact +# uses: actions/upload-artifact@v2.2.3 +# with: +# name: Cider-macOS-${{ env.APP_VERSION }} +# path: | +# dist/*.dmg +# dist/latest-mac.yml - name: Upload files to release uses: svenstaro/upload-release-action@v2 @@ -107,10 +109,7 @@ jobs: # A personal access token for the GitHub repository in which the release will be created and edited. # It is recommended to create the access token with the following scopes: `repo, user, admin:repo_hook`. repo_token: ${{ secrets.RELEASE_TOKEN }} - file_glob: true - file: | - dist/*.dmg - dist/latest-mac.yml + file: test.md tag: v${{ env.APP_VERSION }} # - name: Upload Artifacts to Latest Release From 44d391503b7da15cf7e0abdb1b346437a8b83580 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 21:16:41 +0100 Subject: [PATCH 35/47] test --- resources/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/version.sh b/resources/version.sh index 1129bb95..c01d66c7 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -3,7 +3,7 @@ STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) #COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") -COMMITSINCESTABLE=9 +COMMITSINCESTABLE=22 CURRENT_VERSION=$(node -p -e "require('./package.json').version") echo "Commits since stable: $COMMITSINCESTABLE" From bf1a8fb43a99943b60705666b2aac01a13a049ad Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 21:18:14 +0100 Subject: [PATCH 36/47] multi file test --- .github/workflows/build-macos.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index f5e4d274..04246b50 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -40,7 +40,9 @@ jobs: - name: Change Version run: sudo chmod +x resources/version.sh && ./resources/version.sh || true - - run: echo "test" > test.md + - run: | + echo "test" > test.md + echo "test2" > test2.md # - name: Sign in to EVS # run: | @@ -109,7 +111,9 @@ jobs: # A personal access token for the GitHub repository in which the release will be created and edited. # It is recommended to create the access token with the following scopes: `repo, user, admin:repo_hook`. repo_token: ${{ secrets.RELEASE_TOKEN }} - file: test.md + file: | + test.md + test2.md tag: v${{ env.APP_VERSION }} # - name: Upload Artifacts to Latest Release From d1a8dc893b4ad2b416319d702348ab02dbd63481 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 21:22:02 +0100 Subject: [PATCH 37/47] All done --- .github/workflows/build-macos.yml | 153 ++++++++++++++---------------- 1 file changed, 73 insertions(+), 80 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 04246b50..80a8706e 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -40,96 +40,89 @@ jobs: - name: Change Version run: sudo chmod +x resources/version.sh && ./resources/version.sh || true - - run: | - echo "test" > test.md - echo "test2" > test2.md + - name: Sign in to EVS + run: | + python3 -m pip install --upgrade castlabs-evs + python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} -# - name: Sign in to EVS -# run: | -# python3 -m pip install --upgrade castlabs-evs -# python3 -m castlabs_evs.account refresh -A ${{ secrets.EVS_ACCOUNT_NAME }} -P ${{ secrets.EVS_PASSWD }} -# -# - name: Setup Environment -# run: brew install automake #libtool autoconf -# -# - name: Install and Configure Node Modules -# run: | -# yarn install -# cp resources/verror-types node_modules/@types/verror/index.d.ts -# cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js -# rm -r node_modules/pouchdb-node/node_modules/leveldown -# rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown -# -# -# # Build the DMG -# - name: Build the DMG -# env: -# CSC_LINK: ${{ secrets.CSC_LINK }} -# CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} -# APPLEID: ${{ secrets.APPLEID }} -# APPLEIDPASS: ${{ secrets.APPLEIDPASS }} -# APPLE_ID: ${{ secrets.APPLEID }} -# APPLE_ID_PASSWORD: ${{ secrets.APPLEIDPASS }} -# PSC_NAME: ${{ secrets.PSC_NAME }} -# DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer -# run: yarn dist:universalNotWorking -p never -# -# - name: Add license to DMG -# run: npx dmg-license resources/license.json dist/*.dmg -# -# - name: Import -# uses: apple-actions/import-codesign-certs@v1 -# with: -# p12-file-base64: ${{ secrets.CSC_LINK }} -# p12-password: ${{ secrets.CSC_KEY_PASSWORD }} + - name: Setup Environment + run: brew install automake #libtool autoconf - # Build to PKG -# - name: Build the PKG -# env: -# CSC_LINK: ${{ secrets.CSC_LINK }} -# CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} -# APPLEID: ${{ secrets.APPLEID }} -# APPLEIDPASS: ${{ secrets.APPLEIDPASS }} -# run: | -# pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider-${{ env.APP_VERSION }}-universal.pkg --sign ${{ secrets.PSC_NAME }} -# xcrun altool --notarize-app --primary-bundle-id com.ciderapp.cider -f dist/Cider*.pkg --username ${{ secrets.APPLEID }} --password ${{ secrets.APPLEIDPASS }} -# sleep 5m -# xcrun stapler staple dist/Cider*.pkg || true + - name: Install and Configure Node Modules + run: | + yarn install + cp resources/verror-types node_modules/@types/verror/index.d.ts + cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js + rm -r node_modules/pouchdb-node/node_modules/leveldown + rm -r node_modules/pouchdb-adapter-leveldb/node_modules/leveldown -# - name: Upload a Build Artifact -# uses: actions/upload-artifact@v2.2.3 -# with: -# name: Cider-macOS-${{ env.APP_VERSION }} -# path: | -# dist/*.dmg -# dist/latest-mac.yml + - name: Build the DMG + env: + CSC_LINK: ${{ secrets.CSC_LINK }} + CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + APPLEID: ${{ secrets.APPLEID }} + APPLEIDPASS: ${{ secrets.APPLEIDPASS }} + APPLE_ID: ${{ secrets.APPLEID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLEIDPASS }} + PSC_NAME: ${{ secrets.PSC_NAME }} + DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer + run: yarn dist:universalNotWorking -p never - - name: Upload files to release + - name: Add license to DMG + run: npx dmg-license resources/license.json dist/*.dmg + + - name: Upload DMG uses: svenstaro/upload-release-action@v2 with: repo_name: ciderapp/cider-releases - # A personal access token for the GitHub repository in which the release will be created and edited. - # It is recommended to create the access token with the following scopes: `repo, user, admin:repo_hook`. repo_token: ${{ secrets.RELEASE_TOKEN }} - file: | - test.md - test2.md + file: dist/*.dmg tag: v${{ env.APP_VERSION }} -# - name: Upload Artifacts to Latest Release -# uses: softprops/action-gh-release@v1 -# with: -# body: Full changelog available [here](https://github.com/ciderapp/Cider/compare/stable...main) -# files: | -# dist/*.dmg -# dist/latest-mac.yml -# name: Cider Version ${{ env.APP_VERSION }} (${{ env.GITHUB_REF_NAME }}) -# tag_name: v${{ env.APP_VERSION }} -# repository: ciderapp/cider-releases -# token: ${{ secrets.RELEASE_TOKEN }} -# env: -# GITHUB_REPOSITORY: ciderapp/cider-releases -# GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + - name: Upload macOS Latest + uses: svenstaro/upload-release-action@v2 + with: + repo_name: ciderapp/cider-releases + repo_token: ${{ secrets.RELEASE_TOKEN }} + file: dist/latest-mac.yml + tag: v${{ env.APP_VERSION }} + + - name: Import + uses: apple-actions/import-codesign-certs@v1 + with: + p12-file-base64: ${{ secrets.CSC_LINK }} + p12-password: ${{ secrets.CSC_KEY_PASSWORD }} + + - name: Build the PKG + env: + CSC_LINK: ${{ secrets.CSC_LINK }} + CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + APPLEID: ${{ secrets.APPLEID }} + APPLEIDPASS: ${{ secrets.APPLEIDPASS }} + run: | + pkgbuild --component dist/mac-universal/Cider.app --install-location /Applications dist/Cider-${{ env.APP_VERSION }}-universal.pkg --sign ${{ secrets.PSC_NAME }} + xcrun altool --notarize-app --primary-bundle-id com.ciderapp.cider -f dist/Cider*.pkg --username ${{ secrets.APPLEID }} --password ${{ secrets.APPLEIDPASS }} + sleep 5m + xcrun stapler staple dist/Cider*.pkg || true + + - name: Upload PKG + uses: svenstaro/upload-release-action@v2 + with: + repo_name: ciderapp/cider-releases + repo_token: ${{ secrets.RELEASE_TOKEN }} + file: dist/*.pkg + tag: v${{ env.APP_VERSION }} + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v2.2.3 + with: + name: Cider-macOS-${{ env.APP_VERSION }} + path: | + dist/*.dmg + dist/*.pkg + dist/latest-mac.yml + + From ba41cf02873bb1440ccaea6ca299516a26cbd2b4 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 21:36:41 +0100 Subject: [PATCH 38/47] cache testing --- .github/workflows/build-macos.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 80a8706e..2f9f0afc 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -48,9 +48,17 @@ jobs: - name: Setup Environment run: brew install automake #libtool autoconf + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.cache/yarn + key: yarn-${{ hashFiles('cider-yarn.lock') }} + restore-keys: yarn- + - name: Install and Configure Node Modules run: | - yarn install + mv cider-yarn.lock yarn.lock + yarn install --frozen-lockfile --cache-folder ~/.cache/yarn cp resources/verror-types node_modules/@types/verror/index.d.ts cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js rm -r node_modules/pouchdb-node/node_modules/leveldown @@ -76,7 +84,7 @@ jobs: with: repo_name: ciderapp/cider-releases repo_token: ${{ secrets.RELEASE_TOKEN }} - file: dist/*.dmg + file: dist/Cider-${{ env.APP_VERSION }}-universal.dmg tag: v${{ env.APP_VERSION }} - name: Upload macOS Latest @@ -110,7 +118,7 @@ jobs: with: repo_name: ciderapp/cider-releases repo_token: ${{ secrets.RELEASE_TOKEN }} - file: dist/*.pkg + file: dist/Cider-${{ env.APP_VERSION }}-universal.pkg tag: v${{ env.APP_VERSION }} - name: Upload a Build Artifact From 143e80022effb151c520e33aa93709f34ed717f2 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 21:39:00 +0100 Subject: [PATCH 39/47] cache testing 2 --- .github/workflows/build-macos.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 2f9f0afc..f442edea 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -9,7 +9,6 @@ on: - '.gitmodules' - '.gitignore' - 'LICENSE' - - 'cider.lock' permissions: contents: write @@ -52,12 +51,12 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/yarn - key: yarn-${{ hashFiles('cider-yarn.lock') }} + key: yarn-${{ hashFiles('cider.lock') }} restore-keys: yarn- - name: Install and Configure Node Modules run: | - mv cider-yarn.lock yarn.lock + mv cider.lock yarn.lock yarn install --frozen-lockfile --cache-folder ~/.cache/yarn cp resources/verror-types node_modules/@types/verror/index.d.ts cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js From 515dcdfa0ea31ff4c0922b4d53a3a0ac86de3700 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 21:41:07 +0100 Subject: [PATCH 40/47] cache testing 3 --- .github/workflows/build-macos.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index f442edea..f29b0afd 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -9,6 +9,7 @@ on: - '.gitmodules' - '.gitignore' - 'LICENSE' + - 'cider.lock' permissions: contents: write @@ -47,16 +48,8 @@ jobs: - name: Setup Environment run: brew install automake #libtool autoconf - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ~/.cache/yarn - key: yarn-${{ hashFiles('cider.lock') }} - restore-keys: yarn- - - name: Install and Configure Node Modules run: | - mv cider.lock yarn.lock yarn install --frozen-lockfile --cache-folder ~/.cache/yarn cp resources/verror-types node_modules/@types/verror/index.d.ts cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js From bf7d83a5a535633877b83c14eab18a2398aac6cb Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 21:47:16 +0100 Subject: [PATCH 41/47] removed it --- .github/workflows/build-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index f29b0afd..0bbb17ab 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -50,7 +50,7 @@ jobs: - name: Install and Configure Node Modules run: | - yarn install --frozen-lockfile --cache-folder ~/.cache/yarn + yarn install --frozen-lockfile cp resources/verror-types node_modules/@types/verror/index.d.ts cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js rm -r node_modules/pouchdb-node/node_modules/leveldown From 28add2df5a9c9d7cab2bab235266ea1b119e5c88 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 22:08:42 +0100 Subject: [PATCH 42/47] Ready for merge :) --- .github/workflows/build-macos.yml | 3 --- resources/version.sh | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 0bbb17ab..10991015 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -11,9 +11,6 @@ on: - 'LICENSE' - 'cider.lock' -permissions: - contents: write - jobs: build-macos: name: build-macos diff --git a/resources/version.sh b/resources/version.sh index c01d66c7..12928ad5 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -2,8 +2,7 @@ STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) -#COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") -COMMITSINCESTABLE=22 +COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") CURRENT_VERSION=$(node -p -e "require('./package.json').version") echo "Commits since stable: $COMMITSINCESTABLE" From 47ea55b667c475e5136a7443a294159dde8f9428 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 22:35:24 +0100 Subject: [PATCH 43/47] test --- resources/version.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index 12928ad5..a9c494b8 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,31 +1,26 @@ #!/bin/bash STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) -SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) -COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") +COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count) CURRENT_VERSION=$(node -p -e "require('./package.json').version") -echo "Commits since stable: $COMMITSINCESTABLE" - # Make the version number if [[ $CIRCLE_BRANCH == "stable" || $GITHUB_REF_NAME == "stable" ]]; then - echo "This is a stable branch. Setting stable version." NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} -elif [[ $COMMITSINCESTABLE -gt 0 ]]; then +elif [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMITSINCESTABLE -gt 0 ]]; then echo "This is not a stable branch, but there are commits since the last stable release. Setting beta version." NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" fi -echo "Version: $NEW_VERSION" -echo "Current version: $CURRENT_VERSION" if [[ $COMMITSINCESTABLE -gt 0 ]]; then if [[ $RUNNER_OS == "macOS" ]]; then sed -i "" -e "s/$CURRENT_VERSION/$NEW_VERSION/" package.json else sed -i "0,/$CURRENT_VERSION/s//$NEW_VERSION/" package.json fi + echo "Version updated to v${NEW_VERSION}" else - echo "Version unchanged, commits since stable is ${COMMITSINCESTABLE}" + echo "Version unchanged, commits since stable is v${COMMITSINCESTABLE}" fi if [[ $GITHUB_REF_NAME != "" ]]; then @@ -33,6 +28,3 @@ if [[ $GITHUB_REF_NAME != "" ]]; then else echo "export APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$BASH_ENV fi - -node -p -e "require('./package.json').version" -printenv \ No newline at end of file From e1d731f8ce644803abe3aa4dd430feff3a34f425 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 22:44:51 +0100 Subject: [PATCH 44/47] test 2 --- resources/version.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/resources/version.sh b/resources/version.sh index a9c494b8..aca03be7 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -4,15 +4,11 @@ STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count) CURRENT_VERSION=$(node -p -e "require('./package.json').version") -# Make the version number -if [[ $CIRCLE_BRANCH == "stable" || $GITHUB_REF_NAME == "stable" ]]; then - NEW_VERSION=${CURRENT_VERSION/0/$COMMITSINCESTABLE} -elif [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMITSINCESTABLE -gt 0 ]]; then - echo "This is not a stable branch, but there are commits since the last stable release. Setting beta version." +# Set the version number for commits on main branch +if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "enhancement/ci") && $COMMITSINCESTABLE -gt 0 ]]; then NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" -fi -if [[ $COMMITSINCESTABLE -gt 0 ]]; then + # Update the version in package.json if [[ $RUNNER_OS == "macOS" ]]; then sed -i "" -e "s/$CURRENT_VERSION/$NEW_VERSION/" package.json else @@ -20,9 +16,10 @@ if [[ $COMMITSINCESTABLE -gt 0 ]]; then fi echo "Version updated to v${NEW_VERSION}" else - echo "Version unchanged, commits since stable is v${COMMITSINCESTABLE}" + echo "Not on main branch or no commits since stable. Skipping version update." fi +# Add the version to the environment for CI usage if [[ $GITHUB_REF_NAME != "" ]]; then echo "APP_VERSION=$(node -p -e 'require("./package.json").version')" >>$GITHUB_ENV else From 3646926b20a8d20380b21745881129686c5df030 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 23:15:14 +0100 Subject: [PATCH 45/47] Added it back --- resources/version.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/version.sh b/resources/version.sh index aca03be7..a28a9a8b 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -1,7 +1,8 @@ #!/bin/bash STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) -COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count) +SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) +COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") CURRENT_VERSION=$(node -p -e "require('./package.json').version") # Set the version number for commits on main branch From 1a50133c364cd40a02104a8a52b7f6ebdd65b54d Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 23:19:38 +0100 Subject: [PATCH 46/47] fuck yarn --- .github/workflows/build-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 10991015..d924673c 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -47,7 +47,7 @@ jobs: - name: Install and Configure Node Modules run: | - yarn install --frozen-lockfile + yarn install cp resources/verror-types node_modules/@types/verror/index.d.ts cp resources/macPackager.js node_modules/app-builder-lib/out/macPackager.js rm -r node_modules/pouchdb-node/node_modules/leveldown From efaa6b3b907cf1c6de6cd1795343bf5fec93d7d6 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Wed, 3 Aug 2022 23:36:45 +0100 Subject: [PATCH 47/47] ready --- .github/workflows/build-macos.yml | 2 +- resources/version.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index d924673c..60294db3 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -2,7 +2,7 @@ name: "macOS build" on: push: - branches: [ enhancement/ci ] + branches: [ main, stable ] paths-ignore: - 'README.md' - 'SECURITY.md' diff --git a/resources/version.sh b/resources/version.sh index a28a9a8b..d9464293 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -6,7 +6,7 @@ COMMITSINCESTABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") CURRENT_VERSION=$(node -p -e "require('./package.json').version") # Set the version number for commits on main branch -if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "enhancement/ci") && $COMMITSINCESTABLE -gt 0 ]]; then +if [[ ($CIRCLE_BRANCH == "main" || $GITHUB_REF_NAME == "main") && $COMMITSINCESTABLE -gt 0 ]]; then NEW_VERSION="${CURRENT_VERSION}-beta.${COMMITSINCESTABLE}" # Update the version in package.json