Upgrade @sentry/react #619
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: Deploy | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- id: setup | |
run: | | |
branch="${{ github.event.ref }}" | |
[ "$branch" == "refs/heads/main" ] && branch="main" || true | |
prefix="$branch" | |
[ "$prefix" != "main" ] && prefix="$prefix/${{ github.event.after }}" || true | |
echo "branch=$branch" >> $GITHUB_OUTPUT | |
echo "prefix=$prefix" >> $GITHUB_OUTPUT | |
echo "environment_url=https://openstax.github.io/${{ github.event.repository.name }}/$prefix" >> $GITHUB_OUTPUT | |
- name: create deployment | |
id: create_deployment | |
uses: octokit/request-action@v2.x | |
with: | |
route: POST /repos/:repository/deployments | |
repository: ${{ github.repository }} | |
ref: ${{ github.event.ref }} | |
required_contexts: '[]' | |
transient_environment: true | |
environment: ${{ steps.setup.outputs.branch }} | |
auto_merge: false | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: set deployment status to in progress | |
uses: octokit/request-action@v2.x | |
with: | |
route: POST /repos/:repository/deployments/:deployment/statuses | |
repository: ${{ github.repository }} | |
deployment: ${{ fromJson(steps.create_deployment.outputs.data).id }} | |
environment: ${{ steps.setup.outputs.branch }} | |
environment_url: ${{ steps.setup.outputs.environment_url }} | |
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
state: in_progress | |
mediaType: '{"previews": ["flash", "ant-man"]}' | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- uses: actions/cache@v3 | |
id: node_modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
- id: build | |
run: | | |
prefix="${{ steps.setup.outputs.prefix }}" | |
yarn | |
yarn ladle-build --base "/ui-components/$prefix/" | |
mkdir -p "./$prefix" | |
mv ./docs/* "./$prefix" | |
- uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
clean: false | |
- name: push | |
run: | | |
git config --global user.name 'staxly' | |
git config --global user.email 'staxly@users.noreply.github.com' | |
git add "./${{ steps.setup.outputs.prefix }}" | |
git commit -m "building ${{ steps.setup.outputs.prefix }}" || true | |
git push | |
- name: wait for deployment | |
run: | | |
WAIT_SECONDS=240 | |
until [ $WAIT_SECONDS -le 0 ] || [ "$(curl -s -o /dev/null -w "%{http_code}" ${{ steps.setup.outputs.environment_url }})" != "404" ]; do | |
echo "sleeping 10s">&2 | |
sleep 10 | |
WAIT_SECONDS=$(( WAIT_SECONDS - 10 )) | |
done | |
- name: set deployment status to success | |
uses: octokit/request-action@v2.x | |
with: | |
route: POST /repos/:repository/deployments/:deployment/statuses | |
repository: ${{ github.repository }} | |
deployment: ${{ fromJson(steps.create_deployment.outputs.data).id }} | |
environment: ${{ steps.setup.outputs.branch }} | |
environment_url: ${{ steps.setup.outputs.environment_url }} | |
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
state: success | |
mediaType: '{"previews": ["flash", "ant-man"]}' | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |