Skip to content

Commit 2b37e2e

Browse files
author
Patrick Merlot
committed
ci: upgrade Google Codelabs tools
1 parent 051540d commit 2b37e2e

38 files changed

+86
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Deploy Codelabs
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
11+
build:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30 # Increased timeout for build steps
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: 'true'
20+
token: ${{ secrets.PAT_TOKEN }}
21+
22+
- name: Initialize and update submodules
23+
run: |
24+
git submodule update --init --recursive --depth=0
25+
git submodule sync --recursive
26+
27+
- name: Verify that tools/ folder exists and list its contents
28+
run: |
29+
if [ -d "tools" ]; then
30+
echo "tools/ folder exists. Listing files:"
31+
ls -al tools/
32+
else
33+
echo "tools/ folder does not exist."
34+
exit 1
35+
fi
36+
37+
- name: Install Go
38+
uses: actions/setup-go@v5
39+
with:
40+
go-version: '1.23.0'
41+
- run: go version
42+
43+
- name: Install node and npm
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: 14
47+
48+
- name: Install claat
49+
run: go install github.com/googlecodelabs/tools/claat@latest
50+
51+
- name: Add Go bin to PATH
52+
run: echo "$GOPATH/bin" >> $GITHUB_PATH
53+
54+
- name: Verify claat installation
55+
run: claat --help
56+
57+
- name: Install Gulp globally
58+
run: npm install -g gulp-cli
59+
60+
# Convert markdown files to Codelabs (HTML/CSS/JS)
61+
- name: Export codelabs using claat
62+
run: |
63+
cp -r codelabs/ tools/site/
64+
cd tools/site/codelabs
65+
ls *_en.md | xargs claat export
66+
67+
- name: Install npm dependencies in tools/site/
68+
run: |
69+
cd tools/site/
70+
npm install
71+
72+
- name: Build Codelabs landing page with Gulp
73+
run: |
74+
cd tools/site/
75+
gulp dist --codelabs-dir=codelabs --base-url=https://github.com/patechoc/codelabs
76+
77+
# Deploy to GitHub Pages
78+
- name: Deploy to GitHub Pages
79+
uses: peaceiris/actions-gh-pages@v3
80+
with:
81+
github_token: ${{ secrets.GITHUB_TOKEN }}
82+
publish_dir: tools/site/dist

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "tools"]
2+
path = tools
3+
url = https://github.com/googlecodelabs/tools.git
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)