Skip to content

Commit

Permalink
ci: use go-semantic-release for creating releases
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwenn committed Oct 1, 2024
1 parent 3edd8c1 commit 0a8c69a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 34 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ jobs:
- name: Make
run: make

- name: Run semantic-release
run: make semantic-release repo=${{ github.repository }} dry=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: release
uses: go-semantic-release/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
allow-initial-development-versions: true
force-bump-patch-version: true

- name: Run GoReleaser
run: make go-releaser snapshot=false
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ jobs:
- name: Make
run: make

- name: Dry-run semantic-release
run: make semantic-release repo=${{ github.repository }} dry=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Dry-run release
id: release
uses: go-semantic-release/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
allow-initial-development-versions: true
force-bump-patch-version: true
dry: true

- name: Dry-run GoReleaser
run: make go-releaser snapshot=true
Expand Down
16 changes: 0 additions & 16 deletions .sage/sagefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"go.einride.tech/sage/tools/sggolangcilint"
"go.einride.tech/sage/tools/sggoreleaser"
"go.einride.tech/sage/tools/sggoreview"
"go.einride.tech/sage/tools/sggosemanticrelease"
"go.einride.tech/sage/tools/sgmarkdownfmt"
"go.einride.tech/sage/tools/sgyamlfmt"
)
Expand Down Expand Up @@ -88,21 +87,6 @@ func TypescriptLint(ctx context.Context) error {
).Run()
}

func SemanticRelease(ctx context.Context, repo string, dry bool) error {
sg.Logger(ctx).Println("triggering release...")
args := []string{
"--allow-initial-development-versions",
"--allow-no-changes",
"--ci-condition=default",
"--provider=github",
"--provider-opt=slug=" + repo,
}
if dry {
args = append(args, "--dry")
}
return sggosemanticrelease.Command(ctx, args...).Run()
}

func GoReleaser(ctx context.Context, snapshot bool) error {
sg.Logger(ctx).Println("building Go binary releases...")
if err := sggit.Command(ctx, "fetch", "--force", "--tags").Run(); err != nil {
Expand Down
10 changes: 0 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,6 @@ go-review: $(sagefile)
go-test: $(sagefile)
@$(sagefile) GoTest

.PHONY: semantic-release
semantic-release: $(sagefile)
ifndef repo
$(error missing argument repo="...")
endif
ifndef dry
$(error missing argument dry="...")
endif
@$(sagefile) SemanticRelease "$(repo)" "$(dry)"

.PHONY: typescript-lint
typescript-lint: $(sagefile)
@$(sagefile) TypescriptLint
Expand Down

0 comments on commit 0a8c69a

Please sign in to comment.