Skip to content

Commit

Permalink
Setup CI to download from GitHub Packages registry
Browse files Browse the repository at this point in the history
CI now supports fetching packages from the GitHub Packages registry on
draft PRs. This is meant to support the use of "preview" builds of
controller packages, to more easily test controller changes before they
are released.
  • Loading branch information
Gudahtt committed Nov 18, 2022
1 parent e5bfb39 commit 5ec2f04
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ jobs:
with:
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- name: Determine whether the current PR is a draft
id: set-is-draft
if: github.event_name == 'pull_request' && github.event.pull_request.number
run: echo "IS_DRAFT=$(gh pr view --json isDraft --jq '.isDraft' ${PR_NUMBER})" >> "$GITHUB_OUTPUT"
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup registry config for using package previews on draft PRs
if: github.event_name == 'pull_request' && steps.set-is-draft.outputs.IS_DRAFT == 'true'
run: printf '%s\n\n%s' '@metamask:registry=https://npm.pkg.github.com' "//npm.pkg.github.com/:_authToken=${PACKAGE_READ_TOKEN}" > .npmrc
env:
PACKAGE_READ_TOKEN: ${{ secrets.PACKAGE_READ_TOKEN }}
- run: yarn setup
- uses: actions/cache@v3
id: restore-build
Expand Down

0 comments on commit 5ec2f04

Please sign in to comment.