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/83] 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/83] 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/83] 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/83] 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/83] 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/83] 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/83] 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/83] 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/83] 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/83] 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/83] 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/83] 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 b70ab0b522ac77bf4e539d8fbda2718bc8afbf14 Mon Sep 17 00:00:00 2001 From: Maikiwi Date: Sun, 24 Jul 2022 13:35:10 -0700 Subject: [PATCH 13/83] Revert back to music metadata --- src/main/providers/local/index.ts | 113 +++++------------------------- 1 file changed, 19 insertions(+), 94 deletions(-) diff --git a/src/main/providers/local/index.ts b/src/main/providers/local/index.ts index 289cad82..0c32b042 100644 --- a/src/main/providers/local/index.ts +++ b/src/main/providers/local/index.ts @@ -6,7 +6,6 @@ import * as mm from 'music-metadata'; import {Md5} from 'ts-md5/dist/md5'; import e from "express"; import { EventEmitter } from 'events'; -import { parseFile, recursiveFolderSearch } from 'cider_utils'; export class LocalFiles { static localSongs: any = []; @@ -35,23 +34,22 @@ export class LocalFiles { static async scanLibrary() { ProviderDB.init() let folders = utils.getStoreValue("libraryPrefs.localPaths") - if (folders == null || folders.length == null || folders.length == 0) folders = [] + if (folders == null || folders.length == null || folders.length == 0) folders = ["D:\\Music"] console.log('folders', folders) - let parseFileQueue: any[] = []; let mmQueue: any[] = [] + let files: any[] = [] for (var folder of folders) { - // Recursively search and add - let result = await recursiveFolderSearch(folder) - parseFileQueue = parseFileQueue.concat(result.parseFile) - mmQueue = mmQueue.concat(result.musicMetadata) + // get files from the Music folder + files = files.concat(await LocalFiles.getFiles(folder)) } - if (parseFileQueue.length !== 0 || mmQueue.length !== 0) {console.log('Recursive Folder Search in Cider Utils worki')} + + //console.log("cider.files", files2); + let supporttedformats = ["mp3", "aac", "webm", "flac", "m4a", "ogg", "wav", "opus"] + let audiofiles = files.filter(f => supporttedformats.includes(f.substring(f.lastIndexOf('.') + 1))); + // console.log("cider.files2", audiofiles, audiofiles.length); let metadatalist = [] let metadatalistart = [] let numid = 0; - mmQueue = mmQueue.concat(parseFileQueue) - parseFileQueue = [] - // Music Metadata fallback - for (var audio of mmQueue) { + for (var audio of audiofiles) { try { const metadata = await mm.parseFile(audio); let lochash = Md5.hashStr(audio) ?? numid; @@ -122,83 +120,19 @@ export class LocalFiles { } } catch (e) {console.error("error:", e)} } - - // Cider-Utils supported formats. - for (var audio of parseFileQueue) { - try { - const metadata = await parseFile(audio); - let lochash = Md5.hashStr(audio) ?? numid; - if (metadata != null) { - let form = { - "id": "ciderlocal" + lochash, - "_id": "ciderlocal" + lochash, - "type": "podcast-episodes", - "href": audio, - "attributes": { - "artwork": { - "width": 3000, - "height": 3000, - "url": "/ciderlocalart/" + "ciderlocal" + lochash, - }, - "topics": [], - "url": "", - "subscribable": true, - "mediaKind": "audio", - "genreNames": [ - "" - ], - // "playParams": { - // "id": "ciderlocal" + numid, - // "kind": "podcast", - // "isLibrary": true, - // "reporting": false }, - "trackNumber": metadata.track_number ?? 0, - "discNumber": metadata.disc_number ?? 0, - "name": metadata.title == 0 ? audio.substring(audio.lastIndexOf('\\') + 1) : metadata.title, - "albumName": metadata.album, - "artistName": metadata.artist, - "copyright": metadata.copyright ?? "", - "assetUrl": "file:///" + audio, - "contentAdvisory": "", - "releaseDateTime": `${metadata.year ?? '2022'}-05-13T00:23:00Z`, - "durationInMillis": metadata.duration_in_ms ?? 0, - "bitrate": metadata.bitrate ?? 0, - "offers": [ - { - "kind": "get", - "type": "STDQ" - } - ], - "contentRating": "clean" - }, - flavor: metadata.bitrate, - localFilesMetadata: { - lossless: metadata.lossless, - container: metadata.container, - bitDepth: metadata.bit_depth, - sampleRate: metadata.sample_rate ?? 0, - }, - }; - let art = { - id: "ciderlocal" + lochash, - _id: "ciderlocalart" + lochash, - url: metadata.artwork != undefined ? metadata.artwork : "", - } - metadatalistart.push(art) - numid += 1; - ProviderDB.db.putIfNotExists(form) - ProviderDB.db.putIfNotExists(art) - metadatalist.push(form) - - if (this.localSongs.length === 0 && numid % 10 === 0) { // send updated chunks only if there is no previous database - this.eventEmitter.emit('newtracks', metadatalist)} - } - } catch (e) {console.error("error:", e)} - } + // console.log('metadatalist', metadatalist); this.localSongs = metadatalist; this.localSongsArts = metadatalistart; return metadatalist; } + static async getFiles(dir: any) { + const dirents = await readdir(dir, { withFileTypes: true }); + const files = await Promise.all(dirents.map((dirent: any) => { + const res = path.resolve(dir, dirent.name); + return dirent.isDirectory() ? this.getFiles(res) : res; + })); + return Array.prototype.concat(...files); + } static async cleanUpDB(){ let folders = utils.getStoreValue("libraryPrefs.localPaths") @@ -218,15 +152,6 @@ export class LocalFiles { } } - static async getFiles(dir: any) { - const dirents = await readdir(dir, { withFileTypes: true }); - const files = await Promise.all(dirents.map((dirent: any) => { - const res = path.resolve(dir, dirent.name); - return dirent.isDirectory() ? this.getFiles(res) : res; - })); - return Array.prototype.concat(...files); - } - static setupHandlers () { const app = utils.getExpress() console.log("Setting up handlers for local files") From 2dee6ade9602d57a9560978311d1ca4dd3139465 Mon Sep 17 00:00:00 2001 From: Maikiwi Date: Sun, 24 Jul 2022 13:37:17 -0700 Subject: [PATCH 14/83] gimp v2 --- src/main/providers/local/index.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/providers/local/index.ts b/src/main/providers/local/index.ts index 0c32b042..bdcf547c 100644 --- a/src/main/providers/local/index.ts +++ b/src/main/providers/local/index.ts @@ -34,18 +34,15 @@ export class LocalFiles { static async scanLibrary() { ProviderDB.init() let folders = utils.getStoreValue("libraryPrefs.localPaths") - if (folders == null || folders.length == null || folders.length == 0) folders = ["D:\\Music"] - console.log('folders', folders) + if (folders == null || folders.length == null || folders.length == 0) folders = [] let files: any[] = [] for (var folder of folders) { // get files from the Music folder files = files.concat(await LocalFiles.getFiles(folder)) } - //console.log("cider.files", files2); let supporttedformats = ["mp3", "aac", "webm", "flac", "m4a", "ogg", "wav", "opus"] let audiofiles = files.filter(f => supporttedformats.includes(f.substring(f.lastIndexOf('.') + 1))); - // console.log("cider.files2", audiofiles, audiofiles.length); let metadatalist = [] let metadatalistart = [] let numid = 0; @@ -118,7 +115,7 @@ export class LocalFiles { if (this.localSongs.length === 0 && numid % 10 === 0) { // send updated chunks only if there is no previous database this.eventEmitter.emit('newtracks', metadatalist)} } - } catch (e) {console.error("error:", e)} + } catch (e) {console.error("localfiles error:", e)} } // console.log('metadatalist', metadatalist); this.localSongs = metadatalist; From 8f09ba5e93c6da9feca5474f64a8c620eed08dc1 Mon Sep 17 00:00:00 2001 From: Maikiwi Date: Sun, 24 Jul 2022 13:46:47 -0700 Subject: [PATCH 15/83] remove local files as experiment --- src/renderer/views/components/settings-window.ejs | 15 --------------- src/renderer/views/components/sidebar.ejs | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/renderer/views/components/settings-window.ejs b/src/renderer/views/components/settings-window.ejs index e1000337..a4d9f9aa 100644 --- a/src/renderer/views/components/settings-window.ejs +++ b/src/renderer/views/components/settings-window.ejs @@ -1210,21 +1210,6 @@ - -
-
- Local Files -
-
- -
-
-
{{$root.getLz('settings.option.experimental.compactUI')}} diff --git a/src/renderer/views/components/sidebar.ejs b/src/renderer/views/components/sidebar.ejs index ae664b66..ad88b271 100644 --- a/src/renderer/views/components/sidebar.ejs +++ b/src/renderer/views/components/sidebar.ejs @@ -138,7 +138,7 @@ > -