Revert #1136 and use actionslib instead.

revert chore: bump the module path to `/v3`, take the version from the VCS stamp (#1136)

gitea can not consume the runner's api by version while it's version mismatches the module version:

```
go: gitea.com/gitea/runner@v3.0.1: invalid version: module contains a go.mod file,
so module path must match major version ("gitea.com/gitea/runner/v3")
```

Fix that by bumping the module version now. The existing `v3.0.0` and `v3.0.1` tags stay unusable, so a new tag is needed after this lands.

Also drop the version `-X` linker flags, which would otherwise have to repeat the new path in both `Makefile` and `.goreleaser.yaml`, where a stale path makes injection silently no-op. Go has recorded the module version in the build info since 1.24, so `Version()` reads it from there, keeping the variable as an override for builds without a VCS stamp.

That part started as https://gitea.com/gitea/runner/pulls/1137 but belongs here: the stamp resolves against the tags that are legal for the module path, so without the `/v3` bump it would report `v1.0.9-0.<ts>-<sha>`. Since `release-nightly.yml` triggers on every push to `main`, splitting them would publish a nightly with a `v1` version.

---------

Co-authored-by: bircni <bircni@icloud.com>
Reviewed-on: https://gitea.com/gitea/runner/pulls/1136
Reviewed-by: techknowlogick <9+techknowlogick@noreply.gitea.com>
Reviewed-by: bircni <bircni@icloud.com>
Co-authored-by: silverwind <me@silverwind.io>
Reviewed-on: https://gitea.com/gitea/runner/pulls/1148
Reviewed-by: Zettat123 <39446+zettat123@noreply.gitea.com>
This commit is contained in:
Lunny Xiao
2026-08-06 21:50:21 +00:00
parent 4c2ab943a8
commit 24c13a1fd0
99 changed files with 223 additions and 226 deletions

View File

@@ -20,10 +20,10 @@ import (
"runtime"
"strings"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/common/git"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/common/git"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/model"
"github.com/kballard/go-shellquote"
)

View File

@@ -17,8 +17,8 @@ import (
"testing"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

View File

@@ -12,8 +12,8 @@ import (
"strconv"
"strings"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/model"
)
func evaluateCompositeInputAndEnv(ctx context.Context, parent *RunContext, step actionStep) map[string]string {

View File

@@ -13,10 +13,10 @@ import (
"testing"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/common/git"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/common/git"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

View File

@@ -8,9 +8,9 @@ import (
"testing"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/exprparser"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/exprparser"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

View File

@@ -10,7 +10,7 @@ import (
"regexp"
"strings"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/act/common"
)
var commandPatternGA *regexp.Regexp

View File

@@ -11,8 +11,8 @@ import (
"os"
"testing"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/model"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"

View File

@@ -8,8 +8,8 @@ import (
"context"
"io"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"github.com/stretchr/testify/mock"
)

View File

@@ -16,10 +16,10 @@ import (
"strings"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/exprparser"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/exprparser"
"gitea.com/gitea/runner/act/model"
_ "embed"

View File

@@ -9,8 +9,8 @@ import (
"strings"
"testing"
"gitea.com/gitea/runner/v3/act/exprparser"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/exprparser"
"gitea.com/gitea/runner/act/model"
assert "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

View File

@@ -9,7 +9,7 @@ import (
"runtime"
"testing"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/act/container"
mobyclient "github.com/moby/moby/client"
)

View File

@@ -21,10 +21,10 @@ import (
"time"
"unicode"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/exprparser"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/exprparser"
"gitea.com/gitea/runner/act/model"
)
const maxJobSummaryBytes = 1024 * 1024

View File

@@ -20,9 +20,9 @@ import (
"testing"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/model"
log "github.com/sirupsen/logrus"
logrustest "github.com/sirupsen/logrus/hooks/test"

View File

@@ -11,8 +11,8 @@ import (
"path"
"strings"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
)
// GitHub's job-hook variables, read as a fallback when the settings are unset.

View File

@@ -11,8 +11,8 @@ import (
"maps"
"testing"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/model"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"

View File

@@ -16,7 +16,7 @@ import (
"path/filepath"
"strings"
"gitea.com/gitea/runner/v3/act/filecollector"
"gitea.com/gitea/runner/act/filecollector"
)
type LocalRepositoryCache struct {

View File

@@ -17,7 +17,7 @@ import (
"strings"
"sync"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/act/common"
"github.com/sirupsen/logrus"
"golang.org/x/term"

View File

@@ -6,7 +6,7 @@ package runner
import (
"testing"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
"go.yaml.in/yaml/v4"

View File

@@ -14,9 +14,9 @@ import (
"regexp"
"strings"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/common/git"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/common/git"
"gitea.com/gitea/runner/act/model"
)
func newLocalReusableWorkflowExecutor(rc *RunContext) common.Executor {

View File

@@ -13,8 +13,8 @@ import (
"testing"
"time"
"gitea.com/gitea/runner/v3/act/common/git"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common/git"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/require"
)

View File

@@ -25,11 +25,11 @@ import (
"sync"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/exprparser"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/v3/internal/pkg/lock"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/exprparser"
"gitea.com/gitea/runner/act/model"
"gitea.com/gitea/runner/internal/pkg/lock"
"github.com/docker/cli/cli/compose/loader"
"github.com/docker/go-connections/nat"

View File

@@ -15,10 +15,10 @@ import (
"testing"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/exprparser"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/exprparser"
"gitea.com/gitea/runner/act/model"
"github.com/docker/cli/cli/compose/loader"
log "github.com/sirupsen/logrus"

View File

@@ -14,9 +14,9 @@ import (
"sync"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/model"
docker_container "github.com/moby/moby/api/types/container"
log "github.com/sirupsen/logrus"

View File

@@ -18,8 +18,8 @@ import (
"testing"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/model"
"github.com/joho/godotenv"
log "github.com/sirupsen/logrus"

View File

@@ -13,10 +13,10 @@ import (
"strings"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/exprparser"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/exprparser"
"gitea.com/gitea/runner/act/model"
)
type step interface {

View File

@@ -15,8 +15,8 @@ import (
"path"
"path/filepath"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/model"
)
type stepActionLocal struct {

View File

@@ -12,8 +12,8 @@ import (
"strings"
"testing"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

View File

@@ -16,9 +16,9 @@ import (
"regexp"
"strings"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/common/git"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/common/git"
"gitea.com/gitea/runner/act/model"
gogit "github.com/go-git/go-git/v5"
)

View File

@@ -17,9 +17,9 @@ import (
"testing"
"time"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/common/git"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/common/git"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

View File

@@ -9,9 +9,9 @@ import (
"fmt"
"strings"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/model"
"github.com/kballard/go-shellquote"
)

View File

@@ -11,8 +11,8 @@ import (
"strings"
"testing"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

View File

@@ -7,7 +7,7 @@ package runner
import (
"fmt"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/model"
)
type stepFactory interface {

View File

@@ -7,7 +7,7 @@ package runner
import (
"testing"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
)

View File

@@ -12,10 +12,10 @@ import (
"slices"
"strings"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/lookpath"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/lookpath"
"gitea.com/gitea/runner/act/model"
"github.com/kballard/go-shellquote"
"github.com/sirupsen/logrus"

View File

@@ -10,8 +10,8 @@ import (
"strings"
"testing"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/model"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"

View File

@@ -10,8 +10,8 @@ import (
"io"
"testing"
"gitea.com/gitea/runner/v3/act/container"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/container"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

View File

@@ -9,8 +9,8 @@ import (
"errors"
"testing"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/model"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"

View File

@@ -11,9 +11,9 @@ import (
"regexp"
"strings"
"gitea.com/gitea/runner/v3/act/common"
"gitea.com/gitea/runner/v3/act/common/git"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/common"
"gitea.com/gitea/runner/act/common/git"
"gitea.com/gitea/runner/act/model"
)
// Actions bundle the @actions toolkit into their own JavaScript, and two of its lines keep it

View File

@@ -18,7 +18,7 @@ import (
"testing"
"time"
"gitea.com/gitea/runner/v3/act/artifactcache"
"gitea.com/gitea/runner/act/artifactcache"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

View File

@@ -12,7 +12,7 @@ import (
"strings"
"testing"
"gitea.com/gitea/runner/v3/act/model"
"gitea.com/gitea/runner/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"