-
Notifications
You must be signed in to change notification settings - Fork 103
64 lines (57 loc) · 1.9 KB
/
export-codelab.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Export Codelabs
on:
push:
branches: [ master ]
paths:
- markdown/**
env:
CHANGED_CODELABS: ''
jobs:
Export-Codelab:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.20.5'
- name: Checkout Current Branch
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
token: ${{ secrets.SOLACE_COMMUNITY_BOT_ULTIMATE }}
path: main
- name: Checkout claat repo
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ secrets.SOLACE_COMMUNITY_BOT_ULTIMATE }}
repository: SolaceDev/google-tools
path: google-tools
- name: Build claat
run: cd google-tools/claat; go build .
- name: Get all changed markdown files
id: changed-markdown-files
uses: tj-actions/changed-files@v40
with:
files: |
**.md
path: main
- name: Generate html codelabs
run: |
for file in ${{ steps.changed-markdown-files.outputs.all_changed_files }}; do
folder="$(basename $file .md)"
google-tools/claat/claat export -o main/codelabs/ main/$file
echo "CHANGED_CODELABS=${CHANGED_CODELABS} $folder" >> $GITHUB_ENV
done
- name: Push updates to codelabs repo
run: |
cd main
git config user.name solacecommunity-bot
git config user.email [email protected]
git add codelabs/.
git commit -m "Adding ${{env.CHANGED_CODELABS}} html files"
git push https://solacecommunity-bot:${{secrets.SOLACE_COMMUNITY_BOT_ULTIMATE}}@github.com/Solacedev/solace-dev-codelabs
env:
GITHUB_TOKEN: ${{ secrets.SOLACE_COMMUNITY_BOT_ULTIMATE }}