Skip to content

Commit

Permalink
fixes after testing the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
esolitos authored and gitbutler-client committed Sep 20, 2024
1 parent b9774af commit 55024c2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,21 @@ jobs:
- name: Check for Changes
id: check-diff
env:
VERSION_PREFIX: 'v8*' # We need the 8 or else "vespa-7." will match and sort before "v8.x.y"
VERSION_PATTERN: '^v8\.' # We need the 8 prefix or else "vespa-7." will match and sort before "v8.x.y"
GH_TOKEN: ${{ github.token }}
run: |
set -x
# Checks for changes since the last release.
new_tag="v${{ steps.meta.outputs.version }}"
previous_tag=$(git tag --list "${VERSION_PREFIX}" --sort="-version:refname" | grep -v "${new_tag}" | head -n 1)
previous_tag=$(gh release list --exclude-drafts --exclude-pre-releases --json tagName --jq '.[0].tagName' | grep -E "${VERSION_PATTERN}" | head -n 1)
# If the previous tag and the current tag are the same, there are no changes.
if [[ "${previous_tag}" == "${new_tag}" ]]; then
echo "No changes detected between ${previous_tag} and ${new_tag}."
echo "has-changes=false" >> "${GITHUB_OUTPUT}"
exit 0
fi
# Detect if we are using a dev version (starts with "0.0.0-dev").
if [[ "${new_tag:0:}" == "0.0.0-dev" ]]; then
Expand Down Expand Up @@ -88,14 +98,18 @@ jobs:
# This workflow only interacts with the client/go directory, so we can set the working directory here.
working-directory: client/go

env:
VERSION: ${{ needs.prepare.outputs.build-version }}
HAS_CHANGES: ${{ needs.prepare.outputs.changes-detected }}

steps:
- uses: actions/checkout@v4
with:
ref: "v${{ needs.prepare.outputs.build-version }}"

- uses: actions/setup-go@v5

- name: build
env:
VERSION: ${{ needs.prepare.outputs.build-version }}
run: |
make clean dist
Expand Down
14 changes: 7 additions & 7 deletions client/go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ dist-homebrew:
#
# $ make dist-github
--dist-github: dist
RELEASE_URL="$(gh release create v$(VERSION)
--verify-tag
--repo vespa-engine/vespa
--notes-file $(CURDIR)/README.md
--title "Vespa CLI $(VERSION)"
$(DIST)/vespa-cli_$(VERSION)_sha256sums.txt
$(DIST)/vespa-cli_$(VERSION)_*.zip
RELEASE_URL="$(gh release create v$(VERSION) \
--verify-tag \
--repo vespa-engine/vespa \
--notes-file $(CURDIR)/README.md \
--title "Vespa CLI $(VERSION)" \
$(DIST)/vespa-cli_$(VERSION)_sha256sums.txt \
$(DIST)/vespa-cli_$(VERSION)_*.zip \
$(DIST)/vespa-cli_$(VERSION)_*.tar.gz)"

echo $RELEASE_URL > /tmp/vespa-cli-release-url.txt
Expand Down

0 comments on commit 55024c2

Please sign in to comment.