Deploy for Forked PR #21770
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 for Forked PR | |
on: status | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Dump Github context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Checkout | |
if: "endsWith(github.event.context, 'ci/circleci: build') && github.event.state == 'success'" | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
if: "endsWith(github.event.context, 'ci/circleci: build') && github.event.state == 'success'" | |
uses: actions/setup-python@v1 | |
with: | |
python-version: '3.9' | |
- name: Download Build | |
if: "endsWith(github.event.context, 'ci/circleci: build') && github.event.state == 'success'" | |
id: build_download | |
run: | | |
echo "==== $(date): Starting pipenv setup... ====" | |
pip install pipenv | |
pipenv install | |
echo "==== $(date): Download build site... ====" | |
pipenv run ./content-repo/download_site_build.py -e "$GITHUB_EVENT_PATH" | |
- name: Setup Node | |
if: "steps.build_download.outputs.forked_pr > 0" | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '16.x' | |
# - name: Deploy Netlify Build | |
# if: "steps.build_download.outputs.forked_pr > 0" | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# FORKED_PR: ${{ steps.build_download.outputs.forked_pr }} | |
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
# run: | | |
# echo "==== $(date): extract build zip... ====" | |
# tar xzf build-site.tar.gz | |
# echo "==== $(date): Starting Netlify install... ====" | |
# npm install -g netlify-cli | |
# echo "==== $(date): Netlify deploy... ====" | |
# netlify deploy -m "CircleCI forked pr build: $FORKED_PR" -d build --alias=pull-request-$FORKED_PR --json > deploy-info.json | |
# cat deploy-info.json | |
# echo "==== $(date): Posting comment to PR ... ====" | |
# PR_NUM=$FORKED_PR pipenv run ./content-repo/post_github_comment.py deploy-info.json | |
- name: Deploy Firebase Build | |
if: "steps.build_download.outputs.forked_pr > 0" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FORKED_PR: ${{ steps.build_download.outputs.forked_pr }} | |
FIREBASE_JSON_KEY: ${{ secrets.FIREBASE_JSON_KEY }} | |
run: | | |
echo "==== $(date): extract build zip... ====" | |
tar xzf build-site.tar.gz | |
echo "==== $(date): Starting Firebase install... ====" | |
echo $FIREBASE_JSON_KEY > "$HOME"/gcloud.json | |
npm install firebase-tools@~11.0.1 | |
export GOOGLE_APPLICATION_CREDENTIALS="$HOME"/gcloud.json | |
export PATH="$PATH:`pwd`/node_modules/.bin" | |
echo "==== $(date): Firebase deploy for PR: $FORKED_PR ... ====" | |
firebase hosting:channel:deploy "pull-request-$FORKED_PR" --only xsoar.pan.dev > deploy-info-firebase.txt | |
cat deploy-info-firebase.txt | |
echo "==== $(date): Posting comment to PR ... ====" | |
PR_NUM=$FORKED_PR pipenv run ./content-repo/post_github_comment.py deploy-info-firebase.txt |