Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Use unified version string
Browse files Browse the repository at this point in the history
$(git describe --exact-match --tags $(git rev-parse HEAD) 2>/dev/null || echo unreleased)-$(git rev-parse --short HEAD)

With tag:    v0.0.0-ceaf04c9
Without tag: unreleased-ceaf04c9
  • Loading branch information
meain committed Oct 14, 2022
1 parent 5036bf7 commit 305286e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ jobs:
with:
go-version-file: src/go.mod

- id: version
run: echo "::set-output name=version::$(git describe --exact-match --tags $(git rev-parse HEAD) 2>/dev/null || echo unreleased)-$(git rev-parse --short HEAD)"

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3 # TODO(meain): make sure release builds work
with:
Expand All @@ -244,6 +247,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUDDERSTACK_CORSO_WRITE_KEY: ${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }}
RUDDERSTACK_CORSO_DATA_PLANE_URL: ${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }}
CORSO_VERSION: ${{ steps.version.outputs.version }}

- name: Upload assets
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -306,13 +310,11 @@ jobs:
- uses: actions/checkout@v3

- name: Build Corso Binaries
run: >
run: |
export CORSO_BUILD_LDFLAGS="-X 'github.com/alcionai/corso/src/internal/events.RudderStackWriteKey=${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }}' \
-X 'github.com/alcionai/corso/src/internal/events.RudderStackDataPlaneURL=${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }}'
-X 'github.com/alcionai/corso/src/cli.version=$(git describe --exact-match --tags $(git rev-parse HEAD) 2>/dev/null || echo dev)' \
-X 'github.com/alcionai/corso/src/cli.commit=$(git rev-parse HEAD)' \
./build.sh
--platforms ${{ env.PLATFORMS }}
-X 'github.com/alcionai/corso/src/cli.version=$(git describe --exact-match --tags $(git rev-parse HEAD) 2>/dev/null || echo unreleased)-$(git rev-parse --short HEAD)'"
./build.sh --platforms ${{ env.PLATFORMS }}
# apparently everyone uses this step
- name: Set up QEMU
Expand Down
3 changes: 1 addition & 2 deletions src/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ builds:
- goos: windows
goarch: arm64
ldflags:
- -X 'github.com/alcionai/corso/src/cli.version={{.Version}}'
- -X 'github.com/alcionai/corso/src/cli.commit={{.Commit}}'
- -X 'github.com/alcionai/corso/src/cli.version={{.Env.CORSO_VERSION}}'
- -X 'github.com/alcionai/corso/src/internal/events.RudderStackWriteKey={{.Env.RUDDERSTACK_CORSO_WRITE_KEY}}'
- -X 'github.com/alcionai/corso/src/internal/events.RudderStackDataPlaneURL={{.Env.RUDDERSTACK_CORSO_DATA_PLANE_URL}}'

Expand Down
7 changes: 2 additions & 5 deletions src/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ import (
"github.com/alcionai/corso/src/pkg/logger"
)

var (
version = "dev"
commit = "none"
)
var version = "dev"

// ------------------------------------------------------------------------------------------
// Corso Command
Expand All @@ -43,7 +40,7 @@ var corsoCmd = &cobra.Command{
func handleCorsoCmd(cmd *cobra.Command, args []string) error {
v, _ := cmd.Flags().GetBool("version")
if v {
print.Infof(cmd.Context(), "Corso\nversion: "+version+"\ncommit: "+commit)
print.Infof(cmd.Context(), "Corso\nversion: "+version)
return nil
}

Expand Down

0 comments on commit 305286e

Please sign in to comment.