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

Added vite config and updated deploy to gh-pages script. #102

Closed
wants to merge 7 commits into from
Closed
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ target/
.classpath
.project
.settings/

/dist
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=false
39 changes: 25 additions & 14 deletions build-bin/idl_to_gh_pages → build-bin/dist_to_gh_pages
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,37 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note renaming this file will break deploy. you can fix that by also changing build-bin/deploy with the name change.

In general, unless using an IDE like IntelliJ which detects this sort of thing for you, go back and do a recursive search any time you rename or delete some part of the build.

set -ue

ORIGIN_BRANCH='master'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these variables add confusion. I guess you are extracting them for tests. Please use these conventions if we must override for tests and add a comment that we are doing this.

# we never change these during deployment, these variables are only here for ad-hoc tests.
DEFAULT_BRANCH=master
GH_PAGES_BRANCH=gh-pages

TARGET_BRANCH='gh-pages'

# Update gh-pages
git fetch origin gh-pages:gh-pages
git checkout gh-pages
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me know how you tested this script as historically changes to scripts like this break and I need to fix them later when deployment failed.

git fetch origin $TARGET_BRANCH:$TARGET_BRANCH
git checkout $TARGET_BRANCH



git checkout -qf $TARGET_BRANCH

# Remove everything except .git
rm -rf *

git checkout $ORIGIN_BRANCH docs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The less vocabulary in a script, the better. I was wondering what this "docs" directory was about. Consider the name of the repo is zipkin-api and there is no directory named docs anywhere. I was looking at this script later and wondering if something made a directory named docs via the build process.

In our docker builds, we use the directory named "install" that works, workspace, etc.

Suggested change
git checkout $ORIGIN_BRANCH docs
git checkout $DEFAULT_BRANCH workspace


git checkout -qf gh-pages
cd docs
pnpm i
pnpm run build

# TODO: these files can be in a list for convenience.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is why you were adding this in the vite-config? This deserves a comment there to avoid me re-asking the same questions!

something like?

// these files were formerly checked out from master in build-bin/idl_to_gh_pages.
// We now package them directly when making the openapi dist

git checkout master zipkin-api.yaml
git add zipkin-api.yaml
git checkout master zipkin2-api.yaml
git add zipkin2-api.yaml
git checkout master zipkin.proto
git add zipkin.proto
cp -r ./dist/* ../
cd ..
rm -rf ./docs

files_to_commit=$(git status -s)
if [ ! -z "${files_to_commit}" ]; then
git commit -m "Automatically updated IDL"
echo "Pushing ${files_to_commit} to gh-pages"
git push origin gh-pages
git add --all
git commit -m "Automatically updated dist"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
git commit -m "Automatically updated dist"
git commit -m "Automatically updated site"

echo "Pushing ${files_to_commit} to $TARGET_BRANCH"
git push origin $TARGET_BRANCH
fi

# back to master
git checkout master
git checkout $ORIGIN_BRANCH
49 changes: 49 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!--

Copyright 2018-2024 The OpenZipkin Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.

-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

*,
*:before,
*:after
{
box-sizing: inherit;
}

body
{
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading
Loading