diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml deleted file mode 100644 index 3ecc29e7e..000000000 --- a/.github/workflows/tag.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Tag -on: - push: - paths-ignore: - - ".github/**" - - "README.md" - - ".gitignore" - branches: - - master - -jobs: - tag: - name: Tag release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: mathieudutour/github-tag-action@v4.5 - id: tag_version - with: - github_token: ${{ secrets.PAT }} - tag_prefix: "v" diff --git a/.github/workflows/testing-git.yml b/.github/workflows/testing-git.yml index 1cdbd1b61..55a182485 100644 --- a/.github/workflows/testing-git.yml +++ b/.github/workflows/testing-git.yml @@ -1,14 +1,11 @@ name: Test against pacman-git -# This workflow is triggered on pushes to the repository. on: - push: + pull_request: paths-ignore: - "doc/**" + - "**/*.po" - "README.md" - ".gitignore" - branches-ignore: - - "master" - pull_request: jobs: build: diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 21c9dd285..c5d22ccf5 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -1,14 +1,11 @@ name: Test against pacman -# This workflow is triggered on pushes to the repository. on: - push: + pull_request: paths-ignore: - "doc/**" + - "**/*.po" - "README.md" - ".gitignore" - branches-ignore: - - "master" - pull_request: jobs: build: diff --git a/cmd.go b/cmd.go index d7d62d98b..35d861d24 100644 --- a/cmd.go +++ b/cmd.go @@ -256,7 +256,7 @@ func handleVersion() { func handlePrint(ctx context.Context, cmdArgs *parser.Arguments, dbExecutor db.Executor) error { switch { case cmdArgs.ExistsArg("d", "defaultconfig"): - tmpConfig := settings.DefaultConfig() + tmpConfig := settings.DefaultConfig(yayVersion) fmt.Printf("%v", tmpConfig) return nil diff --git a/pkg/settings/config.go b/pkg/settings/config.go index 98ac9e13b..c85efa19f 100644 --- a/pkg/settings/config.go +++ b/pkg/settings/config.go @@ -71,10 +71,13 @@ type Configuration struct { BatchInstall bool `json:"batchinstall"` SingleLineResults bool `json:"singlelineresults"` Runtime *Runtime `json:"-"` + Version string `json:"version"` } // SaveConfig writes yay config to file. func (c *Configuration) Save(configPath string) error { + c.Version = c.Runtime.Version + marshalledinfo, err := json.MarshalIndent(c, "", "\t") if err != nil { return err @@ -171,7 +174,7 @@ func (c *Configuration) setPrivilegeElevator() error { return &ErrPrivilegeElevatorNotFound{confValue: c.SudoBin} } -func DefaultConfig() *Configuration { +func DefaultConfig(version string) *Configuration { return &Configuration{ AURURL: "https://aur.archlinux.org", BuildDir: os.ExpandEnv("$HOME/.cache/yay"), @@ -213,11 +216,12 @@ func DefaultConfig() *Configuration { EditMenu: false, UseAsk: false, CombinedUpgrade: false, + Version: version, } } func NewConfig(version string) (*Configuration, error) { - newConfig := DefaultConfig() + newConfig := DefaultConfig(version) cacheHome, errCache := getCacheHome() if errCache != nil { @@ -248,6 +252,7 @@ func NewConfig(version string) (*Configuration, error) { newConfig.Runtime = &Runtime{ ConfigPath: configPath, + Version: version, Mode: parser.ModeAny, SaveConfig: false, CompletionPath: filepath.Join(cacheHome, completionFileName), diff --git a/pkg/settings/config_test.go b/pkg/settings/config_test.go index 27b399490..1c6c544a7 100644 --- a/pkg/settings/config_test.go +++ b/pkg/settings/config_test.go @@ -88,7 +88,7 @@ func TestConfiguration_setPrivilegeElevator(t *testing.T) { os.Chmod(doas, 0o755) assert.NoError(t, err) - config := DefaultConfig() + config := DefaultConfig("test") config.SudoLoop = true config.SudoFlags = "-v" @@ -116,7 +116,7 @@ func TestConfiguration_setPrivilegeElevator_su(t *testing.T) { os.Chmod(doas, 0o755) assert.NoError(t, err) - config := DefaultConfig() + config := DefaultConfig("test") config.SudoLoop = true config.SudoFlags = "-v" @@ -138,7 +138,7 @@ func TestConfiguration_setPrivilegeElevator_no_path(t *testing.T) { oldPath := os.Getenv("PATH") os.Setenv("PATH", "") - config := DefaultConfig() + config := DefaultConfig("test") config.SudoLoop = true config.SudoFlags = "-v" @@ -165,7 +165,7 @@ func TestConfiguration_setPrivilegeElevator_doas(t *testing.T) { os.Chmod(doas, 0o755) assert.NoError(t, err) - config := DefaultConfig() + config := DefaultConfig("test") config.SudoLoop = true config.SudoFlags = "-v" @@ -192,7 +192,7 @@ func TestConfiguration_setPrivilegeElevator_custom_script(t *testing.T) { os.Chmod(wrapper, 0o755) assert.NoError(t, err) - config := DefaultConfig() + config := DefaultConfig("test") config.SudoLoop = true config.SudoBin = wrapper config.SudoFlags = "-v" @@ -226,7 +226,7 @@ func TestConfiguration_setPrivilegeElevator_pacman_auth_doas(t *testing.T) { os.Chmod(sudo, 0o755) require.NoError(t, err) - config := DefaultConfig() + config := DefaultConfig("test") config.SudoBin = "sudo" config.SudoLoop = true config.SudoFlags = "-v" @@ -260,7 +260,7 @@ func TestConfiguration_setPrivilegeElevator_pacman_auth_sudo(t *testing.T) { os.Chmod(sudo, 0o755) require.NoError(t, err) - config := DefaultConfig() + config := DefaultConfig("test") config.SudoBin = "doas" config.SudoLoop = true config.SudoFlags = "-v" diff --git a/pkg/settings/runtime.go b/pkg/settings/runtime.go index 38ced3cd2..e5c119e98 100644 --- a/pkg/settings/runtime.go +++ b/pkg/settings/runtime.go @@ -14,6 +14,7 @@ import ( type Runtime struct { Mode parser.TargetMode + Version string // current version of yay SaveConfig bool CompletionPath string ConfigPath string