diff --git a/.github/workflows/sync-stacktodate.yml b/.github/workflows/sync-stacktodate.yml new file mode 100644 index 0000000..b058e43 --- /dev/null +++ b/.github/workflows/sync-stacktodate.yml @@ -0,0 +1,30 @@ +name: Sync Stack To Date + +on: + push: + branches: [ master, main ] + +jobs: + sync-stacktodate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.25' + + - name: Download dependencies + run: go mod download + + - name: Build stacktodate + run: go build -o stacktodate + + - name: Check stacktodate config + run: ./stacktodate check + + - name: Push stacktodate config + run: ./stacktodate push + env: + STD_TOKEN: ${{ secrets.STD_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 950e3b1..297bed5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,3 +26,9 @@ jobs: - name: Run tests run: go test -v ./... + + - name: Build stacktodate + run: go build -o stacktodate + + - name: Check stacktodate config + run: ./stacktodate check diff --git a/cmd/check.go b/cmd/check.go index c4208b7..2bcf03e 100644 --- a/cmd/check.go +++ b/cmd/check.go @@ -44,6 +44,11 @@ var checkCmd = &cobra.Command{ Short: "Check if detected versions match stacktodate.yml", Long: `Verify that the versions in stacktodate.yml match the currently detected versions in your project. Useful for CI/CD pipelines.`, Run: func(cmd *cobra.Command, args []string) { + // Use default config file if not specified + if checkConfigFile == "" { + checkConfigFile = "stacktodate.yml" + } + // Load config without requiring UUID config, err := helpers.LoadConfig(checkConfigFile) if err != nil { @@ -53,11 +58,7 @@ var checkCmd = &cobra.Command{ // Resolve absolute path for directory management absConfigPath, err := helpers.ResolveAbsPath(checkConfigFile) if err != nil { - if checkConfigFile == "" { - absConfigPath, _ = helpers.ResolveAbsPath("stacktodate.yml") - } else { - helpers.ExitOnError(err, "failed to resolve config path") - } + helpers.ExitOnError(err, "failed to resolve config path") } // Get config directory diff --git a/cmd/update.go b/cmd/update.go index 3d759c7..1dc5e12 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -87,6 +87,7 @@ var updateCmd = &cobra.Command{ var updateConfigFile string func init() { + rootCmd.AddCommand(updateCmd) // Flags for update command updateCmd.Flags().StringVarP(&updateConfigFile, "config", "c", "stacktodate.yml", "Path to stacktodate.yml config file (default: stacktodate.yml)") updateCmd.Flags().BoolVar(&skipAutodetect, "skip-autodetect", false, "Skip autodetection of project technologies") diff --git a/stacktodate.yml b/stacktodate.yml new file mode 100644 index 0000000..6c35789 --- /dev/null +++ b/stacktodate.yml @@ -0,0 +1,6 @@ +uuid: 1fe0b376-1df7-4848-bf2d-525acdce6b82 +name: stacktodate-cli +stack: + go: + version: "1.25" + source: go.mod