-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94610d2
commit 26ba88b
Showing
4 changed files
with
231 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,132 +1,147 @@ | ||
env: | ||
PRODUCTION: true | ||
PRODUCTION: true | ||
name: Deploy | ||
run-name: ${{ github.actor }} deploys 🚀 | ||
on: | ||
push: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build-interactive-examples: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: webdoky/interactive-examples | ||
ref: master | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
- run: yarn install | ||
- run: yarn build | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
if-no-files-found: error | ||
name: interactive-examples | ||
path: ./docs/ | ||
build-revamp: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
- name: Install dependencies | ||
run: "go get ..." | ||
- name: Build summary generator | ||
run: cd revamp/generators/src/summary && go build -o ../../../../exe/ | ||
- name: Build format-links preprocessor | ||
run: cd revamp/preprocessors/src/format-links && go build -o ../../../../exe/ | ||
- name: Build inject-authors preprocessor | ||
run: cd revamp/preprocessors/src/inject-authors && go build -o ../../../../exe/ | ||
- name: Build rewire-paths preprocessor | ||
run: cd revamp/preprocessors/src/rewire-paths && go build -o ../../../../exe/ | ||
- name: Build run-macros preprocessor | ||
run: cd revamp/preprocessors/src/run-macros && go build -o ../../../../exe/ | ||
- name: Build strip-frontmatter preprocessor | ||
run: cd revamp/preprocessors/src/strip-frontmatter && go build -o ../../../../exe/ | ||
- name: Build writer preprocessor | ||
run: cd revamp/preprocessors/src/writer && go build -o ../../../../exe/ | ||
- name: Build fix-interactive-examples postprocessor | ||
run: cd revamp/postprocessors/src/fix-interactive-examples && go build -o ../../../../exe/ | ||
- name: Build move-media postprocessor | ||
run: cd revamp/postprocessors/src/move-media && go build -o ../../../../exe/ | ||
- name: Build populate-algolia postprocessor | ||
run: cd revamp/postprocessors/src/populate-algolia && go build -o ../../../../exe/ | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
if-no-files-found: error | ||
name: revamp | ||
path: ./exe/ | ||
build: | ||
needs: [build-interactive-examples, build-revamp] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
submodules: true | ||
- name: Setup MDBook | ||
run: mkdir bin && curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.35/mdbook-v0.4.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: revamp | ||
path: revamp/exe | ||
- run: ls ./revamp/exe | ||
- run: cp ./src/index-template.md ./content/files/uk/index.md | ||
- run: chmod +x ./revamp/exe/summary && ./revamp/exe/summary | ||
- run: chmod +x ./revamp/exe/format-links | ||
- run: chmod +x ./revamp/exe/inject-authors | ||
- run: chmod +x ./revamp/exe/rewire-paths | ||
- run: chmod +x ./revamp/exe/run-macros | ||
- run: chmod +x ./revamp/exe/strip-frontmatter | ||
- run: chmod +x ./revamp/exe/writer | ||
- run: ./bin/mdbook build | ||
- run: ls ./book | ||
- run: ls . | ||
- run: cp -r ./live-samples ./book/live-samples | ||
- run: cp ./src/robots.txt ./book/robots.txt | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: interactive-examples | ||
path: book/interactive-examples | ||
# - run: chmod +x ./revamp/exe/populate-algolia | ||
- run: chmod +x ./revamp/exe/fix-interactive-examples && ./revamp/exe/fix-interactive-examples | ||
- run: chmod +x ./revamp/exe/move-media && ./revamp/exe/move-media | ||
- run: sudo apt install rename | ||
# Recursively replace all asterisks in folder names with "_asterisk_" | ||
- run: find ./book -depth -type d -name "*" -execdir rename 's/\*/_asterisk_/g' "{}" \; | ||
# Recursively replace all doublecolons in folder names with "_doublecolon_" | ||
- run: find ./book -depth -type d -name "*" -execdir rename 's/::/_doublecolon_/g' "{}" \; | ||
# Recursively replace all colons in folder names with "_colon_" | ||
- run: find ./book -depth -type d -name "*" -execdir rename 's/:/_colon_/g' "{}" \; | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
if-no-files-found: error | ||
name: build | ||
path: book | ||
deploy: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: build | ||
path: book | ||
- run: sudo apt install rename | ||
# Recursively replace all "_asterisk_" in folder names with asterisks | ||
- run: find ./book -depth -type d -name "*_asterisk_*" -execdir rename 's/_asterisk_/*/g' "{}" \; | ||
# Recursively replace all "_doublecolon_" in folder names with doublecolons | ||
- run: find ./book -depth -type d -name "*_doublecolon_*" -execdir rename 's/_doublecolon_/::/g' "{}" \; | ||
# Recursively replace all "_colon_" in folder names with colons | ||
- run: find ./book -depth -type d -name "*_colon_*" -execdir rename 's/_colon_/:/g' "{}" \; | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
- run: yarn global add surge | ||
- run: surge --project ./book --domain webdoky3.surge.sh | ||
env: | ||
SURGE_LOGIN: ${{ env.SURGE_LOGIN }} | ||
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | ||
build-interactive-examples: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: webdoky/interactive-examples | ||
ref: master | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
- run: yarn install | ||
- run: yarn build | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
if-no-files-found: error | ||
name: interactive-examples | ||
path: ./docs/ | ||
build-revamp: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
- name: Install dependencies | ||
run: "go get ..." | ||
- name: Build index generator | ||
run: cd revamp/generators/src/index && go build -o ../../../../exe/ | ||
- name: Build summary generator | ||
run: cd revamp/generators/src/summary && go build -o ../../../../exe/ | ||
- name: Build format-links preprocessor | ||
run: cd revamp/preprocessors/src/format-links && go build -o ../../../../exe/ | ||
- name: Build inject-authors preprocessor | ||
run: cd revamp/preprocessors/src/inject-authors && go build -o ../../../../exe/ | ||
- name: Build rewire-paths preprocessor | ||
run: cd revamp/preprocessors/src/rewire-paths && go build -o ../../../../exe/ | ||
- name: Build run-macros preprocessor | ||
run: cd revamp/preprocessors/src/run-macros && go build -o ../../../../exe/ | ||
- name: Build strip-frontmatter preprocessor | ||
run: cd revamp/preprocessors/src/strip-frontmatter && go build -o ../../../../exe/ | ||
- name: Build writer preprocessor | ||
run: cd revamp/preprocessors/src/writer && go build -o ../../../../exe/ | ||
- name: Build fix-interactive-examples postprocessor | ||
run: cd revamp/postprocessors/src/fix-interactive-examples && go build -o ../../../../exe/ | ||
- name: Build move-media postprocessor | ||
run: cd revamp/postprocessors/src/move-media && go build -o ../../../../exe/ | ||
- name: Build populate-algolia postprocessor | ||
run: cd revamp/postprocessors/src/populate-algolia && go build -o ../../../../exe/ | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
if-no-files-found: error | ||
name: revamp | ||
path: ./exe/ | ||
build: | ||
needs: [build-interactive-examples, build-revamp] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
submodules: true | ||
- name: Setup MDBook | ||
run: mkdir bin && curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.35/mdbook-v0.4.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: revamp | ||
path: revamp/exe | ||
- run: ls ./revamp/exe | ||
- run: chmod +x ./revamp/exe/index && ./revamp/exe/index | ||
- run: chmod +x ./revamp/exe/summary && ./revamp/exe/summary | ||
- run: chmod +x ./revamp/exe/format-links | ||
- run: chmod +x ./revamp/exe/inject-authors | ||
- run: chmod +x ./revamp/exe/rewire-paths | ||
- run: chmod +x ./revamp/exe/run-macros | ||
- run: chmod +x ./revamp/exe/strip-frontmatter | ||
- run: chmod +x ./revamp/exe/writer | ||
- run: ./bin/mdbook build | ||
- run: ls ./book | ||
- run: ls . | ||
- run: cp -r ./live-samples ./book/live-samples | ||
- run: cp ./src/robots.txt ./book/robots.txt | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: interactive-examples | ||
path: book/interactive-examples | ||
- run: chmod +x ./revamp/exe/fix-interactive-examples && ./revamp/exe/fix-interactive-examples | ||
- run: chmod +x ./revamp/exe/move-media && ./revamp/exe/move-media | ||
- run: sudo apt install rename | ||
# Recursively replace all asterisks in folder names with "_asterisk_" | ||
- run: find ./book -depth -type d -name "*" -execdir rename 's/\*/_asterisk_/g' "{}" \; | ||
# Recursively replace all doublecolons in folder names with "_doublecolon_" | ||
- run: find ./book -depth -type d -name "*" -execdir rename 's/::/_doublecolon_/g' "{}" \; | ||
# Recursively replace all colons in folder names with "_colon_" | ||
- run: find ./book -depth -type d -name "*" -execdir rename 's/:/_colon_/g' "{}" \; | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
if-no-files-found: error | ||
name: build | ||
path: book | ||
populate-algolia: | ||
needs: [build-revamp] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
submodules: true | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: revamp | ||
path: revamp/exe | ||
- run: chmod +x ./revamp/exe/populate-algolia | ||
- run: ./revamp/exe/populate-algolia | ||
deploy: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: build | ||
path: book | ||
- run: sudo apt install rename | ||
# Recursively replace all "_asterisk_" in folder names with asterisks | ||
- run: find ./book -depth -type d -name "*_asterisk_*" -execdir rename 's/_asterisk_/*/g' "{}" \; | ||
# Recursively replace all "_doublecolon_" in folder names with doublecolons | ||
- run: find ./book -depth -type d -name "*_doublecolon_*" -execdir rename 's/_doublecolon_/::/g' "{}" \; | ||
# Recursively replace all "_colon_" in folder names with colons | ||
- run: find ./book -depth -type d -name "*_colon_*" -execdir rename 's/_colon_/:/g' "{}" \; | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
- run: yarn global add surge | ||
- run: surge --project ./book --domain webdoky3.surge.sh | ||
env: | ||
SURGE_LOGIN: ${{ env.SURGE_LOGIN }} | ||
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} |
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 |
---|---|---|
|
@@ -31,8 +31,8 @@ build: book book/interactive-examples book/live-samples book/robots.txt | |
content: | ||
git submodule add [email protected]:webdoky/content.git ./content | ||
|
||
content/files/uk/index.md: src/index-template.md | ||
cp ./src/index-template.md ./content/files/uk/index.md | ||
content/files/uk/index.md: content/CHANGELOG.md revamp/exe/index src/index-template.md | ||
./revamp/exe/index | ||
|
||
content/files/uk/SUMMARY.md: revamp/exe/summary | ||
./revamp/exe/summary | ||
|
@@ -42,7 +42,7 @@ clean: | |
|
||
deploy: build revamp/exe/populate-algolia | ||
./revamp/exe/populate-algolia | ||
exit 1 | ||
. ${HOME}/.nvm/nvm.sh && nvm use 18 && npx surge --project ./book --domain webdoky3.surge.sh | ||
|
||
install: | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
|
@@ -70,6 +70,9 @@ revamp/exe/summary: revamp/generators/src/summary | |
revamp/exe/fix-interactive-examples: revamp/postprocessors/src/fix-interactive-examples | ||
cd revamp/postprocessors/src/fix-interactive-examples && go build -o ../../../exe/ | ||
|
||
revamp/exe/index: revamp/generators/src/index | ||
cd revamp/generators/src/index && go build -o ../../../exe/ | ||
|
||
revamp/exe/move-media: revamp/postprocessors/src/move-media | ||
cd revamp/postprocessors/src/move-media && go build -o ../../../exe/ | ||
|
||
|
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,64 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"strings" | ||
) | ||
|
||
func getTemplate() (string, error) { | ||
// read src/index-template.md | ||
// and return it | ||
indexTemplate, err := os.ReadFile("src/index-template.md") | ||
if err != nil { | ||
return "", err | ||
} | ||
return string(indexTemplate), nil | ||
} | ||
|
||
const MAX_SECTIONS = 2 | ||
|
||
func main() { | ||
// Read content/CHANGELOG.md file | ||
fileContent, err := os.ReadFile("content/CHANGELOG.md") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
fileContentString := string(fileContent) | ||
// split into lines | ||
// find first line that starts with "## " | ||
// find next line that starts with "## " | ||
// and find line that starts with ## after that | ||
// and replace "## " with "### " | ||
lines := strings.Split(fileContentString, "\n") | ||
result := "" | ||
sectionsFound := 0 | ||
for i, line := range lines { | ||
log.Println(line) | ||
if strings.HasPrefix(line, "## ") { | ||
sectionsFound++ | ||
if sectionsFound > MAX_SECTIONS { | ||
break | ||
} | ||
result += strings.ReplaceAll(line, "## ", "### ") | ||
} else { | ||
if sectionsFound > 0 { | ||
result += line | ||
} | ||
} | ||
if i != 0 { | ||
result += "\n" | ||
} | ||
} | ||
|
||
template, err := getTemplate() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
md := strings.Replace(template, "{{CHANGELOG}}", result, 1) | ||
// Write md to content/files/uk/index.md file | ||
err = os.WriteFile("content/files/uk/index.md", []byte(md), 0644) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
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