This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 888ca45.
- Loading branch information
1 parent
888ca45
commit a3d5e1b
Showing
4 changed files
with
39 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,43 @@ jobs: | |
- name: Check Vulnerabilities | ||
run: mage -v vuln | ||
|
||
generate-spec: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: fetch history | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19.4 | ||
cache: true | ||
|
||
- name: Install Mage | ||
run: go install github.com/magefile/mage | ||
|
||
- name: Update to latest spec | ||
shell: bash | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
go install github.com/swaggo/swag/cmd/[email protected] | ||
mage spec | ||
- name: Push generated spec file | ||
uses: actions/checkout@v3 | ||
- run: | | ||
git config --global user.name "${GITHUB_ACTOR}" | ||
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
if (git diff --shortstat | grep '[0-9]'); then \ | ||
git add .; \ | ||
git commit -m "gen OpenAPI Spec by github-actions"; \ | ||
git push | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,11 +108,7 @@ func Integration() error { | |
// Spec generates an OpenAPI spec yaml based on code annotations. | ||
func Spec() error { | ||
swagCommand := "swag" | ||
if err := installIfNotPresent(swagCommand, "github.com/swaggo/swag/cmd/[email protected]"); err != nil { | ||
logrus.Fatal(err) | ||
return err | ||
} | ||
if err := sh.Run(swagCommand, "fmt", "-d", "pkg/server/router"); err != nil { | ||
if err := installIfNotPresent(swagCommand, "github.com/swaggo/swag/cmd/swag@latest"); err != nil { | ||
logrus.Fatal(err) | ||
return err | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters