Skip to content

Commit f31e248

Browse files
Update static.yml to try to make some string replacement before the build.
1 parent 105659d commit f31e248

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

.github/workflows/static.yml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ name: Deploy static content to Pages
44
on:
55
# Runs on pushes targeting the default branch
66
push:
7-
branches: ["master"]
7+
branches: "current_branch"
88
pull_request:
99
branches:
10-
- '*'
10+
- "*"
1111

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

@@ -19,8 +19,44 @@ concurrency:
1919
cancel-in-progress: false
2020

2121
jobs:
22+
replace_string:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Set environment variable for branch name
26+
env:
27+
BRANCH_NAME: ${{ github.ref }}
28+
run: echo "Branch name is $BRANCH_NAME"
29+
- name: Set environment variable for complete repo name
30+
env:
31+
REPO_NAME: ${{ github.repository }}
32+
run: echo "Repository name is $REPO_NAME"
33+
- name: Set repo name
34+
run: |
35+
project_name="quantstack.github.io"
36+
echo "The value of my_string is: $project_name"
37+
- name: Set environment variable for owner name
38+
env:
39+
REPO_OWNER: ${{ github.repository_owner }}
40+
run: echo "Repository name is $REPO_OWNER"
41+
- name: Set environment variable for actor
42+
env:
43+
ACTOR_NAME: ${{ github.actor }}
44+
run: echo "Actor is $ACTOR_NAME"
45+
- name: Replace baseUrl in config file
46+
run: |
47+
prev_base_url=`baseUrl: "/"`
48+
new_base_url=`baseUrl: "/quantstack.github.io/"`
49+
organization= `organizationName: "/QuantStack/"`
50+
fork_name= `organizationName:` + "$ACTOR_NAME"
51+
echo "organization is $organization"
52+
echo "fork_name is $fork_name"
53+
sed -i 's/prev_base_url/new_base_url/g' docusaurus.config.ts
54+
sed -i 's/prev_organization/new_base_url/g' docusaurus.config.ts
55+
cat > test.ts
56+
2257
build:
2358
runs-on: ubuntu-latest
59+
needs: replace_string
2460
steps:
2561
- name: Checkout
2662
uses: actions/checkout@v4
@@ -39,7 +75,7 @@ jobs:
3975

4076
deploy:
4177
needs: build
42-
if: github.ref == 'refs/heads/master'
78+
#if: github.ref == 'refs/heads/master'
4379
environment:
4480
name: github-pages
4581
url: ${{ steps.deployment.outputs.page_url }}
@@ -51,4 +87,4 @@ jobs:
5187
steps:
5288
- name: Deploy to GitHub Pages
5389
id: deployment
54-
uses: actions/deploy-pages@v4
90+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)