verify install instructions

This commit is contained in:
maddalax 2024-09-25 14:02:10 -05:00
parent a1186ae347
commit 277fa8b316
2 changed files with 62 additions and 7 deletions

View file

@ -0,0 +1,50 @@
name: Build and Verify Installer Works
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Go
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.20'
# Step 3: Install htmgo CLI
- name: Install htmgo CLI
run: |
go install github.com/maddalax/htmgo/cli/htmgo@latest
# Step 4: Generate template using htmgo
- name: Generate myapp template
run: |
htmgo template myapp
# Step 5: Build the app
- name: Build myapp
run: |
cd myapp
htmgo build
# Step 6: Verify that the dist directory exists
- name: Verify build output
run: |
if [ ! -d "./myapp/dist" ]; then
echo "Build directory ./dist/myapp does not exist"
exit 1
fi
shell: bash

View file

@ -112,13 +112,18 @@ func main() {
_ = css.GenerateCss(process.ExitOnError)
_ = run.Server(process.ExitOnError)
} else if taskName == "template" {
name := ""
if len(os.Args) > 2 {
name = os.Args[2]
} else {
reader := bufio.NewReader(os.Stdin)
fmt.Print("What would you like to call your new app?: ")
text, _ := reader.ReadString('\n')
text = strings.TrimSuffix(text, "\n")
text = strings.ReplaceAll(text, " ", "-")
text = strings.ToLower(text)
downloadtemplate.DownloadTemplate(fmt.Sprintf("./%s", text))
name, _ = reader.ReadString('\n')
}
name = strings.TrimSuffix(name, "\n")
name = strings.ReplaceAll(name, " ", "-")
name = strings.ToLower(name)
downloadtemplate.DownloadTemplate(fmt.Sprintf("./%s", name))
} else if taskName == "build" {
run.Build()
} else if taskName == "generate" {