Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload source maps to Honeybadger #131

Open
ras1 opened this issue Sep 3, 2024 · 0 comments
Open

Upload source maps to Honeybadger #131

ras1 opened this issue Sep 3, 2024 · 0 comments
Assignees

Comments

@ras1
Copy link
Collaborator

ras1 commented Sep 3, 2024

If you want to upload the source maps from the gh-pages branch, you would need to check out the gh-pages branch after deploying and then upload the source maps. Here’s an updated version of the workflow to achieve that:
name: Deploy to GitHub Pages

on:
push:
branches:
- main

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
  - name: Checkout repository
    uses: actions/checkout@v2

  - name: Set up Node.js
    uses: actions/setup-node@v2
    with:
      node-version: '14'

  - name: Install dependencies
    run: npm install

  - name: Build the project
    run: npm run build

  - name: Deploy to GitHub Pages
    run: |
      npm install -g gh-pages
      gh-pages -d build

  - name: Checkout gh-pages branch
    run: |
      git fetch origin gh-pages:gh-pages
      git checkout gh-pages

  - name: Upload Source Maps to Honeybadger
    env:
      HONEYBADGER_API_KEY: ${{ secrets.HONEYBADGER_API_KEY }}
      REVISION: ${{ github.sha }}
    run: |
      for file in static/js/*.map; do
        curl https://api.honeybadger.io/v1/source_maps \
          -F api_key=$HONEYBADGER_API_KEY \
          -F revision=$REVISION \
          -F minified_url=https://<YOUR_GITHUB_USERNAME>.github.io/<YOUR_REPO_NAME>/static/js/$(basename ${file%.map}) \
          -F source_map=@$file \
          -F minified_file=@${file%.map}
      done

This updated workflow checks out the gh-pages branch after deploying and then uploads the source maps from that branch.
If you have any more questions or need further assistance, feel free to ask! 😊

@ras1 ras1 self-assigned this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant