Inject providers individually #1783
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test for feature PR | |
## | |
# This workflow tests, builds, and uploads the extension code for each PR | |
# | |
# It should also keep an updated comment on the PR showing where the upload is | |
# | |
on: | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build: | |
if: ${{ !startsWith(github.head_ref, 'release/') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
always-auth: true | |
node-version: 18 | |
registry-url: https://npm.pkg.github.com | |
scope: '@secretkeylabs' | |
cache: npm | |
- name: Install dependencies | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGE_REGISTRY_TOKEN }} | |
run: npm ci | |
- name: Test | |
run: | | |
npx eslint . | |
npx tsc --noEmit | |
npm test | |
- name: Build | |
env: | |
TRANSAC_API_KEY: ${{ secrets.TRANSAC_API_KEY }} | |
MOON_PAY_API_KEY: ${{ secrets.MOON_PAY_API_KEY }} | |
MIX_PANEL_TOKEN: ${{ secrets.MIX_PANEL_TOKEN }} | |
run: npm run build --if-present | |
- name: Save Filename | |
run: | | |
BRANCH_NAME=$(echo ${{ github.head_ref }} | sed 's/\//-/g') | |
GIT_SHA_SHORT=$(git rev-parse --short ${{ github.event.pull_request.head.sha }}) | |
echo "FILENAME=xverse-extension.$BRANCH_NAME.$GIT_SHA_SHORT" >> $GITHUB_ENV | |
- name: Upload Archive | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.FILENAME }} | |
path: ./build | |
retention-days: 30 | |
if-no-files-found: error | |
comment-on-pr: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
env: | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get artifact URL | |
env: | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
WORKFLOW_ID: ${{ github.run_id }} | |
run: | | |
ARTIFACT_URL="https://github.com/$OWNER/$REPO/actions/runs/$WORKFLOW_ID" | |
echo "ARTIFACT_URL=$ARTIFACT_URL" >> $GITHUB_ENV | |
- name: Delete old bot comments | |
env: | |
PR_ID: ${{ github.event.pull_request.number }} | |
run: | | |
gh api \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/{owner}/{repo}/issues/$PR_ID/comments \ | |
| jq ".[] | select(.user.login==\"github-actions[bot]\") | .id" \ | |
| xargs -I %q gh api \ | |
--method DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/{owner}/{repo}/issues/comments/%q | |
- name: Post test package PR comment | |
env: | |
PR_ID: ${{ github.event.pull_request.number }} | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/{owner}/{repo}/issues/$PR_ID/comments \ | |
-f body="Test with build here: $ARTIFACT_URL" |