-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add versioning system, improve environment management
- Loading branch information
Showing
18 changed files
with
987 additions
and
66 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Fetch tags | ||
run: git fetch --force --tags | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.23" | ||
cache: true | ||
- name: Export Environment Variables | ||
run: | | ||
echo "APP_VERSION=$(bash scripts/get_version.sh)" >> $GITHUB_ENV | ||
echo "GO_VERSION=$(go version)" >> $GITHUB_ENV | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Release Candidate | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Fetch tags | ||
run: git fetch --force --tags | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.23" | ||
cache: true | ||
- name: Export Environment Variables | ||
run: | | ||
echo "APP_VERSION=$(bash scripts/get_version.sh)" >> $GITHUB_ENV | ||
echo "GO_VERSION=$(go version)" >> $GITHUB_ENV | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
version: latest | ||
args: release --clean --snapshot | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/cache | ||
/build | ||
agb/dist | ||
lint_report.json |
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
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
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
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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
package command | ||
|
||
// CleanCommand is a representation of "version" command. | ||
type CleanCommand struct{} | ||
|
||
// NewCleanCommand creates new instance of CleanCommand | ||
func NewCleanCommand() *CleanCommand { | ||
return &CleanCommand{} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package command | ||
|
||
import ( | ||
"agb/config" | ||
"fmt" | ||
) | ||
|
||
// VersionCommand is a representation of "version" command. | ||
type VersionCommand struct{} | ||
|
||
// NewVersionCommand creates new instance of VersionCommand | ||
func NewVersionCommand() *VersionCommand { | ||
return &VersionCommand{} | ||
} | ||
|
||
// Execute runs "version" command's logic. | ||
func (vc *VersionCommand) Execute() error { | ||
version_config := config.NewVersionConfig() | ||
app_version, go_version := version_config.AppVersion, version_config.GoVersion | ||
|
||
fmt.Printf("agb version %s, built with %s\n", app_version, go_version) | ||
return nil | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package config | ||
|
||
var ( | ||
// this data should be overriden during compilation | ||
appVersion = "v0.0.0" | ||
goVersion = "v0.0.0" | ||
) | ||
|
||
// VersionConfig is a version info holder updated dynamically during compilation. | ||
type VersionConfig struct { | ||
AppVersion string | ||
GoVersion string | ||
} | ||
|
||
// NewVersionConfig returns new instance of VersionConfig | ||
func NewVersionConfig() *VersionConfig { | ||
return &VersionConfig{ | ||
AppVersion: appVersion, | ||
GoVersion: goVersion, | ||
} | ||
} |
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
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
Oops, something went wrong.