feat(release): version based on github release tag (#3049)

This commit is contained in:
nitrocode
2023-01-25 19:03:30 -06:00
committed by GitHub
parent 0352406016
commit 89ccb8659a
3 changed files with 17 additions and 9 deletions

View File

@@ -18,11 +18,11 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version-file: go.mod
- name: Run GoReleaser for stable release
uses: goreleaser/goreleaser-action@v4
if: (!contains(github.ref, '-pre.'))
if: (!contains(github.ref, 'pre'))
with:
version: v0.183.0
args: release --rm-dist
@@ -30,7 +30,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate changelog for pre release
if: contains(github.ref, '-pre.')
if: contains(github.ref, 'pre')
id: changelog
run: |
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
@@ -43,7 +43,7 @@ jobs:
- name: Run GoReleaser for pre-release
uses: goreleaser/goreleaser-action@v4
if: contains(github.ref, '-pre.')
if: contains(github.ref, 'pre')
with:
version: v0.183.0
args: release --rm-dist --release-notes=tmp-CHANGELOG.md
@@ -55,7 +55,7 @@ jobs:
name: "Bump Homebrew formula"
runs-on: ubuntu-22.04
if: false
# if: (!contains(github.ref, '-pre.'))
# if: (!contains(github.ref, 'pre'))
steps:
- uses: mislav/bump-homebrew-formula-action@v2
with:

View File

@@ -22,7 +22,7 @@ spec:
fsGroup: 1000 # Atlantis group (1000) read/write access to volumes.
containers:
- name: atlantis
image: ghcr.io/runatlantis/atlantis:v0.22.3
image: ghcr.io/runatlantis/atlantis:latest
env:
- name: ATLANTIS_DATA_DIR
value: /atlantis

14
main.go
View File

@@ -24,9 +24,17 @@ import (
"github.com/spf13/viper"
)
const atlantisVersion = "0.22.3"
// All of this is filled in by goreleaser upon release
// https://goreleaser.com/cookbooks/using-main.version/
var (
version = "dev"
commit = "none"
date = "unknown"
)
func main() {
fmt.Printf("atlantis %s, commit %s, built at %s", version, commit, date)
v := viper.New()
logger, err := logging.NewStructuredLogger()
@@ -40,10 +48,10 @@ func main() {
server := &cmd.ServerCmd{
ServerCreator: &cmd.DefaultServerCreator{},
Viper: v,
AtlantisVersion: atlantisVersion,
AtlantisVersion: version,
Logger: logger,
}
version := &cmd.VersionCmd{AtlantisVersion: atlantisVersion}
version := &cmd.VersionCmd{AtlantisVersion: version}
testdrive := &cmd.TestdriveCmd{}
cmd.RootCmd.AddCommand(server.Init())
cmd.RootCmd.AddCommand(version.Init())