Skip to content

Commit

Permalink
add notes api call and artifact upload to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
joshraphael committed Jan 23, 2025
1 parent 3029860 commit b72bb4d
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module ra-code-notes

go 1.23.0

require github.com/joshraphael/go-retroachievements v1.0.0
2 changes: 2 additions & 0 deletions .github/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/joshraphael/go-retroachievements v1.0.0 h1:Hu1bitG8r9O8AZWx7BfGOyVo9Sga3phxQBq0b8Q/3vQ=
github.com/joshraphael/go-retroachievements v1.0.0/go.mod h1:C+9vQbOqyRJmnFt8XIJ5gwRot+AZS/acnaESp45jtCc=
34 changes: 34 additions & 0 deletions .github/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import (
"encoding/json"
"fmt"
"os"

"github.com/joshraphael/go-retroachievements"
"github.com/joshraphael/go-retroachievements/models"
)

func main() {
client := retroachievements.New(retroachievements.ClientConfig{
Host: retroachievements.RetroAchievementHost,
UserAgent: "go-retroachievements/v1.0.0",
})
notes, err := client.GetCodeNotes(models.GetCodeNotesParameters{
GameID: 4111,
})
if err != nil {
os.Exit(1)
fmt.Println("error getting code notes")
return
}

jsonNotes, err := json.Marshal(notes.CodeNotes)
if err != nil {
os.Exit(1)
fmt.Println("error converting code notes to json")
return
}

fmt.Println(string(jsonNotes))
}
13 changes: 13 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '^1.23.0'

- name: Set ENV vars for github
run: echo "RATOOLS_DIR=~/Installs/RATools-${{env.RATOOLS_VERSION}}" >> $GITHUB_ENV # same as Makefile
Expand All @@ -46,9 +51,17 @@ jobs:
- name: Get .NET SDK 6.0.428
run: bash .github/dotnet-sdk.sh

- name: Get Code Notes
run: make notes

- name: Compile Code
run: make compile

- uses: actions/upload-artifact@v4
with:
name: notes-json
path: ${{env.RALIBRETRO_DIR}}/RACache/Data/4111-Notes.json

- uses: actions/upload-artifact@v4
with:
name: user-text
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ export GAME_ID = 4111

compile:
touch ${RALIBRETRO_DIR}/RACache/Data/${GAME_ID}.json
wine ${RATOOLS_DIR}/rascript-cli.exe -i ${GAME_ID}.rascript -o ${RALIBRETRO_DIR}
wine ${RATOOLS_DIR}/rascript-cli.exe -i ${GAME_ID}.rascript -o ${RALIBRETRO_DIR}

notes:
cd .github/ && go get -t ./... && go run main.go > ${RALIBRETRO_DIR}/RACache/Data/4111-Notes.json

0 comments on commit b72bb4d

Please sign in to comment.