Skip to content

Prince/ added test sitemap generation #231

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
23 changes: 23 additions & 0 deletions .github/actions/generate_test_sitemap_and_robots/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Generate Test Sitemap.xml and Robots.txt"
description: "Generate test version of Sitemap.xml and robots.txt for staging domain"
inputs:
main_domain:
description: "Main domain for sitemap replacement"
required: true
runs:
using: "composite"
steps:
- name: Replace sitemap URLs and create directories for test
shell: bash
env:
MAIN_DOMAIN: ${{ inputs.main_domain }}
run: |
mkdir test_content
domain_name=$(echo $MAIN_DOMAIN | sed 's|https://||g')
mkdir -p test_content/$domain_name
cp sitemap.xml test_content/$domain_name/sitemap.xml
cp robots.txt test_content/$domain_name/robots.txt
node .github/modify_sitemap.js --new-domain $domain_name --input-file test_content/$domain_name/sitemap.xml
node .github/modify_robots.js --sitemap-url $domain_name --input-file test_content/$domain_name/robots.txt
cp test_content/$domain_name/sitemap.xml sitemap.xml
cp test_content/$domain_name/robots.txt robots.txt
22 changes: 22 additions & 0 deletions .github/workflows/publish-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,25 @@ jobs:
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: ${{ env.MESSAGE }}

generate_test_sitemap:
runs-on: ubuntu-latest
needs: publish_site
if: ${{ needs.publish_site.result == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Generate Test Sitemap and Robots.txt
uses: ./.github/actions/generate_test_sitemap_and_robots
with:
main_domain: "https://staging.deriv.com"

- name: Save Test Sitemap and Robots as Artifacts
uses: actions/upload-artifact@v3
with:
name: test-sitemap-robots
path: |
sitemap.xml
robots.txt
retention-days: 5