Skip to content

Commit

Permalink
Merge pull request #380 from fluxcd/update-kubecon
Browse files Browse the repository at this point in the history
Update from source URL
  • Loading branch information
kingdonb authored Mar 7, 2024
2 parents 0a26c42 + 9a164fa commit 40887a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/update-kubecon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ jobs:
- name: Pull html from site and convert to markdown
run: |
# go install github.com/suntong/html2md@latest
HTML2MD=html2md_1.5.0_linux_amd64
HTML2MD_VER=v1.5.0
HTML2MD_BIN="./${HTML2MD}/html2md"
SOURCE_SITE="https://sites.google.com/view/flux-kubecon-paris-2024/home"
export SOURCE_SITE HTML2MD_BIN HTML2MD_VER HTML2MD
# export SOURCE_SITE HTML2MD_BIN HTML2MD_VER HTML2MD
./script/update-kubecon.sh
Expand Down
19 changes: 13 additions & 6 deletions script/update-kubecon.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash
# Define and export these (ahead of the script):
#
# HTML2MD=html2md_1.5.0_linux_amd64
# HTML2MD_VER=v1.5.0
# HTML2MD_BIN="./${HTML2MD}/html2md"
# SOURCE_SITE="https://sites.google.com/view/flux-kubecon-paris-2024/home"
HTML2MD_VER=1.5.0
HTML2MD=html2md_${HTML2MD_VER}_linux_amd64
HTML2MD_VER_SLUG=v${HTML2MD_VER}
HTML2MD_BIN="./${HTML2MD}/html2md"
SOURCE_SITE="https://sites.google.com/view/flux-kubecon-paris-2024/home"
# export SOURCE_SITE HTML2MD_BIN HTML2MD_VER HTML2MD

TEMP_FILE=kubecon.html
Expand All @@ -16,13 +17,19 @@ head=head
if [[ "$OSTYPE" == "darwin"* ]]; then
sed=gsed
head=ghead
DEBUG=1
fi

if [[ -z "$DEBUG" ]]; then
wget https://github.com/suntong/html2md/releases/download/${HTML2MD_VER}/${HTML2MD}.tar.gz -O ${HTML2MD}.tar.gz
wget https://github.com/suntong/html2md/releases/download/${HTML2MD_VER_SLUG}/${HTML2MD}.tar.gz -O ${HTML2MD}.tar.gz
tar xvf ${HTML2MD}.tar.gz
else
HTML2MD_BIN=`which html2md`
if [[ -z "$HTML2MD_BIN" ]]; then
echo "Run: go install github.com/suntong/html2md@latest and ensure that ~/go/bin/ is in PATH"
echo " Fatal error: html2md was not installed"
exit 1
fi
fi

# sed 1: Remove "Copy heading link" text, which is inserted by Google Site
Expand All @@ -33,7 +40,7 @@ fi
# sed 8: flux booth fun (a caption with a heading h1 followed by three paragraphs!)
# sed 9: the podinfo sample app link is in an HTML block so :( turn it manually into a link
wget ${SOURCE_SITE} -O ${TEMP_FILE} \
&& ${HTML2MD_BIN} -i ${TEMP_FILE} |$sed '1,6d'|$head -n -19 \
&& ${HTML2MD_BIN} -i ${TEMP_FILE} |$sed '1,6d'|$head -n -13 \
| $sed 's_# \[Copy heading link\](\\#h\.[a-z0-9]*)[[:space:]]*_# _' \
| $sed 's_/view/flux-kubecon-paris-2024/home_/kubecon_' \
| $sed -E 's_\[!\[\]\([^)]+\)_[_g' \
Expand Down

0 comments on commit 40887a1

Please sign in to comment.