Skip to content

Commit

Permalink
pkg installer: install cached API data.
Browse files Browse the repository at this point in the history
Continuing with the goals of making the installer:
- more useful
- entirely offline

Let's pre-download the API data from a `brew update` run and install it
into the logged-in user's home directory.
  • Loading branch information
MikeMcQuaid committed Jul 26, 2023
1 parent c7e48ce commit 8c463ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build-pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,24 @@ jobs:
TEMPORARY_KEYCHAIN_FILE: 'homebrew_installer_signing.keychain-db'
MIN_MACOS_VERSION: '11.0'
PKG_APPLE_DEVELOPER_TEAM_ID: ${{ secrets.PKG_APPLE_DEVELOPER_TEAM_ID }}
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT: 1
steps:
- name: Checkout to brew subdirectory
- name: Checkout Homebrew to brew subdirectory
uses: actions/checkout@v3
with:
path: brew
fetch-depth: 0
persist-credentials: false

- name: Update Homebrew
env:
HOMEBREW_CACHE: "${GITHUB_WORKSPACE}/brew/cache"
run: brew/bin/brew update --auto-update

- name: Get Homebrew version from Git
id: print-version
run: echo "version=$(git -C brew describe --tags --always)" >> "${GITHUB_OUTPUT}"
run: echo "version=$(git -C brew/bin/brew describe --tags --always)" >> "${GITHUB_OUTPUT}"

- name: Install Pandoc
run: brew install pandoc
Expand Down
6 changes: 6 additions & 0 deletions package/scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ then
else
chown -R "${logged_in_user}:${group}" .
fi

# move API cache to ~/Library/Caches/Homebrew
user_api_cache_dir=~"${logged_in_user}"/Library/Caches/Homebrew/api
mkdir -p "${user_api_cache_dir}"
mv "${homebrew_directory}/cache/api/"* "${user_api_cache_dir}"
rm -rf "${homebrew_directory}/cache"

0 comments on commit 8c463ee

Please sign in to comment.