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

CI: Support PR Preview #38

Merged
merged 12 commits into from
Sep 9, 2022
Prev Previous commit
Next Next commit
CI: Fix: pushing to production
Shaikh-Ubaid committed Aug 22, 2022
commit 292a1f98349000292856790efba131cdb41fc6f5
8 changes: 5 additions & 3 deletions ci/upload_site.sh
Original file line number Diff line number Diff line change
@@ -39,9 +39,11 @@ git add .
COMMIT_MESSAGE="Deploying on $(date "+%Y-%m-%d %H:%M:%S")"
git commit -m "${COMMIT_MESSAGE}"

if [[ "${GIT_PR_PREVIEW_PRIVATE_SSH_KEY}" == "" ]]; then
echo "Note: GIT_PR_PREVIEW_PRIVATE_SSH_KEY is empty, skipping..."
exit 0
if [[ ${git_ref} != "refs/heads/main" ]]; then
if [[ "${GIT_PR_PREVIEW_PRIVATE_SSH_KEY}" == "" ]]; then
echo "Note: GIT_PR_PREVIEW_PRIVATE_SSH_KEY is empty, skipping..."
exit 0
fi
fi
ssh-add <(echo "$GIT_PR_PREVIEW_PRIVATE_SSH_KEY" | base64 -d)
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have ssh keys setup with a different variable (I believe), so this PR will only use GIT_PR_PREVIEW_PRIVATE_SSH_KEY to push even to production?

I think we should use the production keys for production and preview keys for previews, what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have ssh keys setup with a different variable (I believe), so this PR will only use GIT_PR_PREVIEW_PRIVATE_SSH_KEY to push even to production?

It seems there are no ssh keys required to push to production (as we discussed here #1 (comment) and also tried/tested it by removing the SSH key setup step here c6cee87). We currently need the SSH keys for pushing the test version to pull_request_preview (as pull_request_preview is a separate repository). During production deployment, even if the SSH keys would be available, I guess/think that they would (hopefully) not be used.

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have ssh keys setup with a different variable (I believe)

Please, could you possibly share if it would be possible to rename it and setup its public key at https://github.com/lfortran/pull_request_preview, please

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. It's a little weird that it would quit to push to production if GIT_PR_PREVIEW_PRIVATE_SSH_KEY is empty. But I guess that's fine. Would it make sense to put this into if [[ ${git_ref} != "refs/heads/main" ]]; then if statement?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, got it.