Skip to content

Commit

Permalink
Add automated Schema File publish action (#1858)
Browse files Browse the repository at this point in the history
* Add automated Schema File publish action

The action should be triggered manually after every spec release
and will copy/update schema files from this repository to the
website repository so that they become available publicly.

The publish-schemas action after manual triggering will create a PR
in https://github.com/open-telemetry/opentelemetry.io repo, and the
PR needs to be approved and merged manually.

This is similar to how we publish doc updates from language repos
to the website repo.

Resolves open-telemetry/opentelemetry.io#577
Resolves open-telemetry/opentelemetry-specification#1693

* Make branch name and commit message more relevant

Co-authored-by: Sergey Kanzhelev <[email protected]>
  • Loading branch information
tigrannajaryan and SergeyKanzhelev authored Aug 30, 2021
1 parent 485e0bb commit 163ba78
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish-schemas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Update Schema files at OpenTelemetry Website

on:
# triggers only on a manual dispatch
workflow_dispatch:

jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- name: make-pr
env:
API_TOKEN_GITHUB: ${{secrets.DOC_UPDATE_TOKEN}}
# Destination repo should always be 'open-telemetry/opentelemetry.io'
DESTINATION_REPO: open-telemetry/opentelemetry.io
# Destination path should be the absolute path to directory to publish in
DESTINATION_PATH: static/schemas
# Source path should be 'schemas', all files and folders are copied from here to dest
SOURCE_PATH: schemas
run: |
TARGET_DIR=$(mktemp -d)
export GITHUB_TOKEN=$API_TOKEN_GITHUB
git config --global user.name austinlparker
git config --global user.email [email protected]
git clone "https://[email protected]/$DESTINATION_REPO.git" "$TARGET_DIR"
rsync -av --delete "$SOURCE_PATH/" "$TARGET_DIR/$DESTINATION_PATH/"
cd "$TARGET_DIR"
git checkout -b schemas-$GITHUB_REPOSITORY-$GITHUB_SHA
git add .
git commit -m "Schemas update from $GITHUB_REPOSITORY"
git push -u origin HEAD:schemas-$GITHUB_REPOSITORY-$GITHUB_SHA
gh pr create -t "Schemas Update from $GITHUB_REPOSITORY" -b "This is an automated pull request." -B main -H schemas-$GITHUB_REPOSITORY-$GITHUB_SHA
echo "done"

0 comments on commit 163ba78

Please sign in to comment.