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

enable previews for PRs #146

Closed
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
44 changes: 40 additions & 4 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
branches: "current_branch"
pull_request:
branches:
- '*'
- "*"

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages

Expand All @@ -19,8 +19,44 @@ concurrency:
cancel-in-progress: false

jobs:
replace_string:
runs-on: ubuntu-latest
steps:
- name: Set environment variable for branch name
env:
BRANCH_NAME: ${{ github.ref }}
run: echo "Branch name is $BRANCH_NAME"
- name: Set environment variable for complete repo name
env:
REPO_NAME: ${{ github.repository }}
run: echo "Repository name is $REPO_NAME"
- name: Set repo name
run: |
project_name="quantstack.github.io"
echo "The value of my_string is: $project_name"
- name: Set environment variable for owner name
env:
REPO_OWNER: ${{ github.repository_owner }}
run: echo "Repository name is $REPO_OWNER"
- name: Set environment variable for actor
env:
ACTOR_NAME: ${{ github.actor }}
run: echo "Actor is $ACTOR_NAME"
- name: Replace baseUrl in config file
run: |
prev_base_url=`baseUrl: "/"`
new_base_url=`baseUrl: "/quantstack.github.io/"`
organization= `organizationName: "/QuantStack/"`
fork_name= `organizationName:` + "$ACTOR_NAME"
echo "organization is $organization"
echo "fork_name is $fork_name"
sed -i 's/prev_base_url/new_base_url/g' docusaurus.config.ts
sed -i 's/prev_organization/new_base_url/g' docusaurus.config.ts
cat > test.ts

build:
runs-on: ubuntu-latest
needs: replace_string
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -39,7 +75,7 @@ jobs:

deploy:
needs: build
if: github.ref == 'refs/heads/master'
#if: github.ref == 'refs/heads/master'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand All @@ -51,4 +87,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
Loading