Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/actions/install-pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,43 @@ runs:
run: |
version=$(node -p "require('./package.json').packageManager.slice('pnpm@'.length).split('+')[0]")
echo "version=$version" >> "$GITHUB_OUTPUT"
if [ "${SENTRY_CI_PNPM_VERSION:-}" = "$version" ]; then
echo 'installed=true' >> "$GITHUB_OUTPUT"
fi

- name: Restore pnpm installation
id: cache
if: steps.pnpm.outputs.installed != 'true'
uses: actions/cache/restore@v6.1.0
with:
path: ${{ runner.temp }}/setup-pnpm
key: pnpm-install-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.pnpm.outputs.version }}

# Without a `version` input, the action reads the version from `packageManager`. With both, it fails.
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
if: steps.cache.outputs.cache-hit != 'true'
if: steps.pnpm.outputs.installed != 'true' && steps.cache.outputs.cache-hit != 'true'
with:
dest: ${{ runner.temp }}/setup-pnpm

- name: Use cached pnpm
if: steps.cache.outputs.cache-hit == 'true'
if: steps.pnpm.outputs.installed == 'true' || steps.cache.outputs.cache-hit == 'true'
shell: bash
run: |
pnpm_home="$RUNNER_TEMP/setup-pnpm/node_modules/.bin"
echo "PNPM_HOME=$pnpm_home" >> "$GITHUB_ENV"
echo "$pnpm_home" >> "$GITHUB_PATH"
echo "$pnpm_home/bin" >> "$GITHUB_PATH"

- name: Remember installed pnpm version
shell: bash
env:
PNPM_VERSION: ${{ steps.pnpm.outputs.version }}
run: echo "SENTRY_CI_PNPM_VERSION=$PNPM_VERSION" >> "$GITHUB_ENV"

- name: Save pnpm installation
if: steps.cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/develop'
if: >-
steps.pnpm.outputs.installed != 'true' && steps.cache.outputs.cache-hit != 'true' && github.ref ==
'refs/heads/develop'
uses: actions/cache/save@v6.1.0
with:
path: ${{ runner.temp }}/setup-pnpm
Expand Down
5 changes: 4 additions & 1 deletion .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ runs:
# manifest through the GitHub API in every job, which uses up the repository's `GITHUB_TOKEN` rate limit.
- name: Restore Node.js install
id: node-cache
if: steps.node.outputs.installed != 'true'
uses: actions/cache/restore@v6.1.0
with:
path: ${{ steps.node.outputs.cache-path }}
Expand All @@ -25,7 +26,9 @@ runs:

# Only `develop` saves, so PRs share one entry per architecture instead of each creating their own.
- name: Save Node.js install
if: steps.node-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/develop'
if: >-
steps.node.outputs.installed != 'true' && steps.node-cache.outputs.cache-hit != 'true' && github.ref ==
'refs/heads/develop'
uses: actions/cache/save@v6.1.0
with:
path: ${{ steps.node.outputs.cache-path }}
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/setup-node/resolve-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ cache_path="$RUNNER_TOOL_CACHE/node/$version"
cache_key="node-toolcache-$RUNNER_OS-$RUNNER_ARCH-$version"

printf 'version=%s\ncache-path=%s\ncache-key=%s\n' "$version" "$cache_path" "$cache_key" >> "$GITHUB_OUTPUT"

arch=$(node -p 'process.arch')
if [ -f "$cache_path/$arch.complete" ] && [ -x "$cache_path/$arch/bin/node" ]; then
echo 'installed=true' >> "$GITHUB_OUTPUT"
fi
Loading