From 00cb6deda502f65066ae3c3c4653ea0863872dea Mon Sep 17 00:00:00 2001 From: Darwin Cereska Date: Thu, 7 Aug 2025 03:06:07 -0400 Subject: [PATCH] init: added apprenticevr --- .github/workflows/bump-apprenticevr.yml | 116 ++++++++++++++++++++++++ Casks/apprenticevr.rb | 18 ++++ 2 files changed, 134 insertions(+) create mode 100644 .github/workflows/bump-apprenticevr.yml create mode 100644 Casks/apprenticevr.rb diff --git a/.github/workflows/bump-apprenticevr.yml b/.github/workflows/bump-apprenticevr.yml new file mode 100644 index 0000000..61b15f2 --- /dev/null +++ b/.github/workflows/bump-apprenticevr.yml @@ -0,0 +1,116 @@ +name: Bump ApprenticeVR Cask +on: + workflow_dispatch: + schedule: + - cron: '0 */6 * * *' # every 6 hours (fixed cron syntax) + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - name: Checkout tap repo + uses: actions/checkout@v4 # updated to v4 + with: + persist-credentials: true + + - name: Fetch latest release from GitHub + id: fetch + uses: actions/github-script@v7 # updated to v7 + with: + script: | + const release = await github.rest.repos.getLatestRelease({ + owner: 'jimzrt', + repo: 'apprenticeVr' + }); + + const version = release.data.tag_name; + const cleanVersion = version.replace(/^v/, ''); // Remove 'v' prefix + + core.setOutput("version", cleanVersion); + core.setOutput("tag_name", version); + + // Check if assets exist + const assets = release.data.assets; + const armAsset = assets.find(asset => + asset.name.includes('arm64.dmg') || + asset.name.includes('arm64') + ); + + if (!armAsset) { + core.setFailed('No ARM64 DMG asset found in latest release'); + return; + } + + core.setOutput("download_url", armAsset.browser_download_url); + core.setOutput("asset_name", armAsset.name); + + - name: Download DMG and compute SHA256 + id: compute + run: | + DOWNLOAD_URL="${{ steps.fetch.outputs.download_url }}" + ASSET_NAME="${{ steps.fetch.outputs.asset_name }}" + + echo "Downloading: $DOWNLOAD_URL" + curl -L -o "$ASSET_NAME" "$DOWNLOAD_URL" + + SHA256=$(sha256sum "$ASSET_NAME" | awk '{ print $1 }') + echo "Computed SHA256: $SHA256" + echo "sha256=$SHA256" >> $GITHUB_OUTPUT + + - name: Check current cask version + id: current + run: | + CASK_FILE="Casks/apprenticevr.rb" + if [ -f "$CASK_FILE" ]; then + CURRENT_VERSION=$(grep -o 'version "[^"]*"' "$CASK_FILE" | sed 's/version "\([^"]*\)"/\1/') + echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT + echo "Current version: $CURRENT_VERSION" + else + echo "Cask file not found: $CASK_FILE" + exit 1 + fi + + - name: Update cask file + run: | + VERSION="${{ steps.fetch.outputs.version }}" + SHA256="${{ steps.compute.outputs.sha256 }}" + CURRENT_VERSION="${{ steps.current.outputs.current_version }}" + CASK_FILE="Casks/apprenticevr.rb" + + echo "Current version: $CURRENT_VERSION" + echo "New version: $VERSION" + + if [ "$VERSION" = "$CURRENT_VERSION" ]; then + echo "Version unchanged, skipping update" + echo "skip_commit=true" >> $GITHUB_ENV + else + echo "Updating $CASK_FILE to version $VERSION with SHA256 $SHA256" + + # Update version + sed -i "s/version \"[^\"]*\"/version \"$VERSION\"/g" "$CASK_FILE" + + # Update SHA256 + sed -i "s/sha256 \"[^\"]*\"/sha256 \"$SHA256\"/g" "$CASK_FILE" + + echo "Updated cask file:" + cat "$CASK_FILE" + fi + + - name: Commit and push changes + if: env.skip_commit != 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git add Casks/apprenticevr.rb + + if ! git diff --cached --quiet; then + VERSION="${{ steps.fetch.outputs.version }}" + git commit -m "bump: Updated apprenticevr to $VERSION" + git push + echo "Successfully updated apprenticevr cask to version $VERSION" + else + echo "No changes to commit" + fi \ No newline at end of file diff --git a/Casks/apprenticevr.rb b/Casks/apprenticevr.rb new file mode 100644 index 0000000..f9ef075 --- /dev/null +++ b/Casks/apprenticevr.rb @@ -0,0 +1,18 @@ +cask "apprenticevr" do + version "1.3.4" + sha256 "" + + url "https://github.com/jimzrt/apprenticeVr/releases/download/v#{version}/apprenticevr-#{version}-arm64.dmg" + + name "ApprenticeVR" + desc "An app designed for managing and sideloading content onto Meta Quest devices" + homepage "https://github.com/jimzrt/apprenticeVr" + + app "apprenticevr.app" + + postflight do + system_command "/usr/bin/xattr", + args: ["-c","#{apppdir}/#{app}"], + sudo: false + end +end \ No newline at end of file