-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into @zfurtak/new-eslint-rule
- Loading branch information
Showing
316 changed files
with
5,374 additions
and
2,963 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
ENV="$1" | ||
EXPECTED_VERSION="$2" | ||
|
||
BASE_URL="" | ||
if [[ "$ENV" == 'staging' ]]; then | ||
BASE_URL='https://staging.new.expensify.com' | ||
else | ||
BASE_URL='https://new.expensify.com' | ||
fi | ||
|
||
sleep 5 | ||
ATTEMPT=0 | ||
MAX_ATTEMPTS=10 | ||
while [[ $ATTEMPT -lt $MAX_ATTEMPTS ]]; do | ||
((ATTEMPT++)) | ||
|
||
echo "Attempt $ATTEMPT: Checking deployed version..." | ||
DOWNLOADED_VERSION="$(wget -q -O /dev/stdout "$BASE_URL"/version.json | jq -r '.version')" | ||
|
||
if [[ "$EXPECTED_VERSION" == "$DOWNLOADED_VERSION" ]]; then | ||
echo "Success: Deployed version matches local version: $DOWNLOADED_VERSION" | ||
exit 0 | ||
fi | ||
|
||
if [[ $ATTEMPT -lt $MAX_ATTEMPTS ]]; then | ||
echo "Version mismatch, found $DOWNLOADED_VERSION. Retrying in 5 seconds..." | ||
sleep 5 | ||
fi | ||
done | ||
|
||
echo "Error: Deployed version did not match local version after $MAX_ATTEMPTS attempts. Something went wrong..." | ||
exit 1 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Deploy New Help Site | ||
|
||
on: | ||
# Run on any push to main that has changes to the help directory | ||
# TEST: Verify Cloudflare picks this up even if not run when merged to main | ||
# push: | ||
# branches: | ||
# - main | ||
# paths: | ||
# - 'help/**' | ||
|
||
# Run on any pull request (except PRs against staging or production) that has changes to the help directory | ||
pull_request: | ||
types: [opened, synchronize] | ||
branches-ignore: [staging, production] | ||
paths: | ||
- 'help/**' | ||
|
||
# Run on any manual trigger | ||
workflow_dispatch: | ||
|
||
# Allow only one concurrent deployment | ||
concurrency: | ||
group: "newhelp" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build: | ||
env: | ||
IS_PR_FROM_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Set up Ruby and run bundle install inside the /help directory | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
working-directory: ./help | ||
|
||
- name: Build Jekyll site | ||
run: bundle exec jekyll build --source ./ --destination ./_site | ||
working-directory: ./help # Ensure Jekyll is building the site in /help | ||
|
||
- name: Deploy to Cloudflare Pages | ||
uses: cloudflare/pages-action@v1 | ||
id: deploy | ||
if: env.IS_PR_FROM_FORK != 'true' | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
projectName: newhelp | ||
directory: ./help/_site # Deploy the built site | ||
|
||
- name: Setup Cloudflare CLI | ||
if: env.IS_PR_FROM_FORK != 'true' | ||
run: pip3 install cloudflare==2.19.0 | ||
|
||
- name: Purge Cloudflare cache | ||
if: env.IS_PR_FROM_FORK != 'true' | ||
run: /home/runner/.local/bin/cli4 --verbose --delete hosts=["newhelp.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache | ||
env: | ||
CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }} | ||
|
||
- name: Leave a comment on the PR | ||
uses: actions-cool/maintain-one-comment@v3.2.0 | ||
if: ${{ github.event_name == 'pull_request' && env.IS_PR_FROM_FORK != 'true' }} | ||
with: | ||
token: ${{ github.token }} | ||
body: ${{ format('A preview of your New Help changes have been deployed to {0} :zap:️', steps.deploy.outputs.alias) }} | ||
|
Oops, something went wrong.