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
10 changes: 7 additions & 3 deletions .github/workflows/rdme-delete-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ jobs:
steps:
- name: Check out repo 📚
uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: 18
node-version: 20
cache: 'npm'
- run: npm ci
- name: Add node_modules to PATH
run: echo "$PWD/node_modules/.bin" >> $GITHUB_PATH

- name: Delete staging version
run: |
if rdme versions:delete 0.0-pr-${{ github.event.number }} --key=${{ secrets.README_API_KEY }}; then
status=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE "https://api.readme.com/v2/branches/"3.27-pr-${{ github.event.number }}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.README_API_KEY }}" \

if [ "$status" -eq 204 ]; then
echo "Version deleted successfully"
else
echo "Version doesn't exist, no need to delete"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rdme-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
uses: actions/checkout@v4

- name: Run `docs` command 🚀
uses: readmeio/rdme@v8
uses: readmeio/rdme@b42200405455d8a58572aae4a341a23ff934ae38 # rdme version 10.5.1
with:
rdme: docs ./reference --key=${{ secrets.README_API_KEY }} --version=3.26
rdme: reference upload ./reference --key=${{ secrets.README_API_KEY }} --branch=3.27
57 changes: 35 additions & 22 deletions .github/workflows/rdme-staging.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,68 @@
name: Generate ReadMe Staging 🦉

# This is currently broken, fix this in a future PR
# on:
# # run this workflow on all PRs that have reference dirs changed
# pull_request:
# paths:
# - 'openapi/**'
# - 'reference/**'
# - '.github/actions/**'
# - '.github/workflows/rdme-staging.yml'
on:
# run this workflow on all PRs that have reference dirs changed
pull_request:
paths:
- 'openapi/**'
- 'reference/**'
- '.github/actions/**'
- '.github/workflows/rdme-staging.yml'

jobs:
# ////////////////////////////////////////////////////////////////////////
# Pull Request
# ////////////////////////////////////////////////////////////////////////

# Create a new ReadMe Version if it needs to and pushes content to the version
# Create a new ReadMe version if it needs to and pushes content to the version
rdme-staging:
if: ${{ github.event.pull_request.head.repo.full_name == 'mixpanel/docs' }}
runs-on: ubuntu-latest
steps:
- name: Check out repo 📚
uses: actions/checkout@v4
- uses: actions/setup-node@v4

- uses: actions/setup-node@v5
with:
node-version: 18
node-version: 20
cache: 'npm'

- run: npm ci

- name: Add node_modules to PATH
run: echo "$PWD/node_modules/.bin" >> $GITHUB_PATH

# Try to create the readme version, if it errors it's ok we keep going since it was already created
- name: Create readme version
run: |
if rdme versions:create 0.0-pr-${{ github.event.number }} --key=${{ secrets.README_API_KEY }} --fork=v3.26 --main=false --beta=false --deprecated=false --isPublic=true; then
status=$(curl -s -o /dev/null -w "%{http_code}" -X POST "https://api.readme.com/v2/branches" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.README_API_KEY }}" \
-d '{
"name": "3.27-pr-${{ github.event.number }}",
"base": "3.27",
"release_stage": "release",
"state": "current"
}')

if [ "$status" -eq 201 ]; then
echo "Version created successfully"
else
echo "Errors because the version already exists, and so we can continue to the next step"
fi

- name: Push docs to staging env 🚀
uses: readmeio/rdme@v8
- name: Push docs to version 🚀
uses: readmeio/rdme@b42200405455d8a58572aae4a341a23ff934ae38 # rdme version 10.5.1
with:
rdme: docs ./reference --key=${{ secrets.README_API_KEY }} --version=0.0-pr-${{ github.event.number }}
rdme: reference upload ./reference --key=${{ secrets.README_API_KEY }} --branch=3.27-pr-${{ github.event.number }}

- name: Build OpenAPI specs to version
run: npm run api:build

# Push openapi specs to staging env
- run: npm run api:build
- run: npm run api:publish
- name: Publish OpenAPI specs to version
run: npm run api:publish
env:
README_API_KEY: ${{ secrets.README_API_KEY }}
README_VERSION: 0.0-pr-${{ github.event.number }}
README_VERSION: 3.27-pr-${{ github.event.number }}

# build and update comment with the proper link
preview-notify:
Expand Down Expand Up @@ -78,7 +91,7 @@ jobs:
script: |
return `
# API Reference Preview
:rocket: https://developer.mixpanel.com/v0.0-pr-${{ github.event.number }}/reference/overview
:rocket: https://developer.mixpanel.com/v3.27-pr-${{ github.event.number }}/reference/overview
Last updated: ${new Date().toLocaleString("en-US", {timeZone: "America/Los_Angeles"})} PT from ${{github.sha}}
`

Expand Down
Loading
Loading