Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(version): add version information to cli #336

Merged
merged 4 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ permissions:
packages: write

jobs:
check-version:
uses: ./.github/workflows/release_check_version.yaml

publish-github-image:
needs: [check-version]
uses: ./.github/workflows/release_publish_github_image.yaml
with:
tag: ${{ github.ref_name }}

publish-github-artifacts:
needs: [check-version]
uses: ./.github/workflows/release_publish_github_artifacts.yaml
with:
tag: ${{ github.ref_name }}
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/release_check_version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Check Release Version

on:
workflow_call:
workflow_dispatch:

permissions:
contents: write

jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v11

- name: Use Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v6

- name: Build Resonate binary
run: |
# Build resonate binary
nix build ".#resonate"

# Copy into root
cp ./result/bin/resonate resonate

- name: Check version
env:
GITHUB_REF_VERSION: ${{ github.ref_name }}
run: |
# Extract resonate version
RESONATE_VERSION=$(./resonate -v | awk '{print $3}')
RESONATE_VERSION="v${RESONATE_VERSION}"

# Compare versions
if [ "$RESONATE_VERSION" != "$GITHUB_REF_VERSION" ]; then
echo "Version mismatch: resonate version ($RESONATE_VERSION) does not match GitHub ref ($GITHUB_REF_VERSION)"
exit 1
else
echo "Version match: resonate version ($RESONATE_VERSION) matches GitHub ref ($GITHUB_REF_VERSION)"
fi
5 changes: 3 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ var (
)

var rootCmd = &cobra.Command{
Use: "resonate",
Short: "Durable promises",
Use: "resonate",
Short: "Durable promises",
Version: "0.5.5", // This needs to be bumped when new versions are released.
}

func init() {
Expand Down