Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
leohhhn committed Sep 30, 2024
1 parent 5dc168d commit 604f47a
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 104 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/table-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Check for new presentations

on:
pull_request:
paths:
- 'presentations/**'

jobs:
check-new-folder:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up environment
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Get the list of changed folders
id: diff
run: |
# Get only the added folders in presentations directory
diff_folders=$(git diff --name-status origin/main | grep '^A' | grep 'presentations/' | awk '{print $2}' | cut -d'/' -f2 | sort -u)
echo "Folders detected: $diff_folders"
echo "::set-output name=folders::$diff_folders"
- name: Check new folders against table
run: |
# Path to your markdown table
MD_FILE="scripts/table.md"
# Get the date of the top row in the table
top_row_date=$(grep -oP '^\|[0-9]{4}-[0-9]{2}-[0-9]{2}' $MD_FILE | head -n 1 | tr -d '|')
# Loop through the folders detected
for folder in ${{ steps.diff.outputs.folders }}; do
folder_date=$(echo $folder | grep -oE '^[0-9]{4}-[0-9]{2}-[0-9]{2}')
echo "Comparing folder date: $folder_date with top row date: $top_row_date"
if [[ "$folder_date" > "$top_row_date" ]]; then
echo "New folder $folder is newer than the latest entry in the table ($top_row_date)."
exit 1
else
echo "Table is up to date."
fi
done
- name: Success message
if: success()
run: echo "Table is up to date."

- name: Fail message
if: failure()
run: echo "Please run the generation command to update the table."
50 changes: 0 additions & 50 deletions .github/workflows/table-gen.yml

This file was deleted.

9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ ROWS=15
build:
go run scripts/csvgen.go -path ./presentations -out scripts/data.csv -rows $(ROWS)
cat scripts/data.csv | go run moul.io/mdtable csv > scripts/table.md
go run github.com/leohhhn/embedmd -w README.md

go run github.com/campoy/embedmd -w README.md
# Clean up
rm scripts/data.csv scripts/table.md
rm scripts/data.csv scripts/table.md

./scripts/del-codeblock.sh


34 changes: 0 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,6 @@ presentations.
## Previous workshops & talks

[embedmd]:# (scripts/table.md)
|Date |Title |Speakers |Slides |Recording |
|---- |----- |-------- |------ |--------- |
|2023-09-11 |Gno.land: The Key To Perpetual Transparency |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-09-11--dappcon-key-perpetual-transparency--manfred/presentation.slide.html) |--- |
|2023-07-24 |Examining the Gno Core Stack |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-07-24--talk-nebular--manfred/presentations.slide.html#1) |--- |
|2023-07-23 |Getting Started with Gno! |@moul, @thehowl |[Slides](./README.md) |--- |
|2023-06-26 |Go -> Gno |@schollz |[Slides](./slides.pdf) |--- |
|2023-06-06 |Proof of Contribution in Gno.land |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-06-06--buidl-asia--manfred/presentations.slide.html) |--- |
|2023-06-05 |Gno.land for Go Developers |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-06-05--getting-to-gno-seoul--manfred/presentations.slide.html#1) |--- |
|2023-06-03 |A journey into Gno.land - the Evolution of Smart Contracts |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-06-03--eth-seoul--manfred/presentations.slide.html#1) |--- |
|2023-06-02 |Alice in Gno.land |@zivkovicmilos |[Slides](./README.md) |--- |
|2023-03-16 |How to build a forum in Gno.land |@zivkovicmilos |[Slides](./README.md) |[Recording](https://www.youtube.com/watch?v=gmP-mH-64HA) |
|2023-03-03 |Plan9 as Metaverse |@jaekwon |[Slides](./README.md) |--- |
|2022-11-29 |Minimal meetup.com clone |@moul, @pwnh4 |[Slides](https://github.com/xplrz/gnoland-meetup) |--- |
|2022-11-15 |Intro to gno.land |@moul |--- |--- |
|2022-11-03 |Intro to gno.land |@moul |--- |--- |
|2022-10-18 |Gnoland & Concurrent Smart Contracts |@moul |--- |[Recording](https://www.youtube.com/watch?v=gcZHjlqG8gg&list=PLUg1PF7xcA8WHJ6aXXPi4CckVd7WEukF6&index=8) |
|2022-09-29 |Intro to Gno |@moul, @pwnh4 |[Slides](https://github.com/xplrz/gnoland-workshop) |--- |
|Date |Title |Speakers |Slides |Recording |
|---- |----- |-------- |------ |--------- |
|2023-09-11 |Gno.land: The Key To Perpetual Transparency |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-09-11--dappcon-key-perpetual-transparency--manfred/presentation.slide.html) |--- |
|2023-07-24 |Examining the Gno Core Stack |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-07-24--talk-nebular--manfred/presentations.slide.html#1) |--- |
|2023-07-23 |Getting Started with Gno! |@moul, @thehowl |[Slides](./README.md) |--- |
|2023-06-26 |Go -> Gno |@schollz |[Slides](./slides.pdf) |--- |
|2023-06-06 |Proof of Contribution in Gno.land |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-06-06--buidl-asia--manfred/presentations.slide.html) |--- |
|2023-06-05 |Gno.land for Go Developers |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-06-05--getting-to-gno-seoul--manfred/presentations.slide.html#1) |--- |
|2023-06-03 |A journey into Gno.land - the Evolution of Smart Contracts |@moul |[Slides](https://gnolang.github.io/workshops/presentations/2023-06-03--eth-seoul--manfred/presentations.slide.html#1) |--- |
|2023-06-02 |Alice in Gno.land |@zivkovicmilos |[Slides](./README.md) |--- |
|2023-03-16 |How to build a forum in Gno.land |@zivkovicmilos |[Slides](./README.md) |[Recording](https://www.youtube.com/watch?v=gmP-mH-64HA) |
|2023-03-03 |Plan9 as Metaverse |@jaekwon |[Slides](./README.md) |--- |
|2022-11-29 |Minimal meetup.com clone |@moul, @pwnh4 |[Slides](https://github.com/xplrz/gnoland-meetup) |--- |
|2022-11-15 |Intro to gno.land |@moul |--- |--- |
|2022-11-03 |Intro to gno.land |@moul |--- |--- |
|2022-10-18 |Gnoland & Concurrent Smart Contracts |@moul |--- |[Recording](https://www.youtube.com/watch?v=gcZHjlqG8gg&list=PLUg1PF7xcA8WHJ6aXXPi4CckVd7WEukF6&index=8) |
|2022-09-29 |Intro to Gno |@moul, @pwnh4 |[Slides](https://github.com/xplrz/gnoland-workshop) |--- |

_This table is autogenerated based on the [./presentations](./presentations) folder._

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.22.0
toolchain go1.22.3

require (
github.com/campoy/embedmd v1.0.0
github.com/gnolang/gno v0.2.0
github.com/leohhhn/embedmd v0.0.0-20240927092809-8e38263bfca4
github.com/soypat/go-presentx v1.1.0
golang.org/x/tools v0.23.0
gopkg.in/yaml.v3 v3.0.1
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/campoy/embedmd v1.0.0 h1:V4kI2qTJJLf4J29RzI/MAt2c3Bl4dQSYPuflzwFH2hY=
github.com/campoy/embedmd v1.0.0/go.mod h1:oxyr9RCiSXg0M3VJ3ks0UGfp98BpSSGr0kpiX3MzVl8=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -11,10 +13,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leohhhn/embedmd v0.0.0-20240927091403-cf387c5813fc h1:Er/gGadILy6w8uvl2xMqWCmQfFsIVVDTvZdUhKXPbV0=
github.com/leohhhn/embedmd v0.0.0-20240927091403-cf387c5813fc/go.mod h1:gIO/oEy8jBxhEijdPK0vHbBr+UvRkyeMyOW8LpCl+Ac=
github.com/leohhhn/embedmd v0.0.0-20240927092809-8e38263bfca4 h1:mGWEohV2wrK/WrJoJ4CVTgfGzuQOB48BFElMiBuERpw=
github.com/leohhhn/embedmd v0.0.0-20240927092809-8e38263bfca4/go.mod h1:gIO/oEy8jBxhEijdPK0vHbBr+UvRkyeMyOW8LpCl+Ac=
github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
github.com/peterbourgon/ff/v3 v3.0.0/go.mod h1:UILIFjRH5a/ar8TjXYLTkIvSvekZqPm5Eb/qbGk6CT0=
github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Date of the workshop
date: "2023-09-26"
# Title of the workshop
title: "Chess The Gnolang Way"
# GitHub usernames of the speakers
speakers:
- "thehowl"
# Location of the workshop
location: "San Diego, USA"
# Workshop slides link
slides: ""
# Workshop recording
recording: ""
13 changes: 13 additions & 0 deletions presentations/2023-10-09--generating-audio--schollz/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Date of the workshop
date: "2023-10-09"
# Title of the workshop
title: "Generating Audio"
# GitHub usernames of the speakers
speakers:
- "schollz"
# Location of the workshop
location: "Online"
# Workshop slides link
slides: ""
# Workshop recording
recording: ""
20 changes: 9 additions & 11 deletions scripts/csvgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os"
"path/filepath"
"sort"
"strconv"
"strings"

"github.com/gnolang/gno/tm2/pkg/commands"
Expand All @@ -18,7 +17,7 @@ import (
type cfg struct {
presentationsPath string
outputPath string
rows string
rows int
}

type Metadata struct {
Expand All @@ -30,7 +29,7 @@ type Metadata struct {
}

var (
csvHeader = []string{"Date", "Title", "Speakers", "Slides", "Recording"}
csvHeader = []string{"Date", "Title", "Speakers", "Presentation", "Recording"}
)

func main() {
Expand Down Expand Up @@ -62,10 +61,10 @@ func (c *cfg) RegisterFlags(fs *flag.FlagSet) {
"./data.csv",
"output csv path, including .csv",
)
fs.StringVar(
fs.IntVar(
&c.rows,
"rows",
"15",
15,
"number of rows to generate",
)
}
Expand Down Expand Up @@ -120,6 +119,9 @@ func execGen(cfg *cfg) error {
}

// todo fix local slide links
//fmt.Printf("metadatafile: %s\n", metadataFile)
//fmt.Printf("abs: %s\n", abs)
//fmt.Printf("dir: %s\n", dir.Name())

// Check for empty fields
if err = metadata.Check(abs); err != nil {
Expand All @@ -136,11 +138,7 @@ func execGen(cfg *cfg) error {

// Write sorted rows to the CSV file
// Generate only the last N rows of data
rowNum, err := strconv.Atoi(cfg.rows)
if err != nil {
return err
}
for _, r := range rows[:rowNum] {
for _, r := range rows[:cfg.rows] {
err = writer.Write(r.Format())
if err != nil {
return err
Expand All @@ -160,7 +158,7 @@ func (m Metadata) Format() []string {
if m.Recording == "" {
m.Recording = "---"
} else {
m.Recording = fmt.Sprintf("[Recording](%s)", m.Recording)
m.Recording = fmt.Sprintf("[Video](%s)", m.Recording)
}

return []string{
Expand Down
11 changes: 11 additions & 0 deletions scripts/del-codeblock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Define the file to be processed
FILE="README.md"

# if found line, remove table of size 17 rows

# Use sed to remove the code block backticks
sed -i '' '/^```md$/d; /^```$/d' "$FILE"

echo "Removed code block formatting from $FILE."
11 changes: 11 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Define the file to be processed
FILE="README.md"

# if found line, remove table of size 17 rows

# Use sed to remove the code block backticks
sed -i '' '/^```md$/d; /^```$/d' "$FILE"

echo "Removed code block formatting from $FILE."
2 changes: 1 addition & 1 deletion tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package tools

import (
_ "github.com/leohhhn/embedmd"
_ "github.com/campoy/embedmd"
_ "github.com/soypat/go-presentx"
_ "golang.org/x/tools/cmd/present"
_ "moul.io/mdtable"
Expand Down

0 comments on commit 604f47a

Please sign in to comment.