Skip to content

Commit cb0a595

Browse files
committed
pushing
1 parent 278c07d commit cb0a595

File tree

1 file changed

+45
-4
lines changed

1 file changed

+45
-4
lines changed

.github/workflows/cli.yml

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ permissions:
88

99
env:
1010
CARGO_TERM_COLOR: always
11+
RELEASE_TAG: v1.1.0
1112

1213
jobs:
1314
create_release:
@@ -19,16 +20,47 @@ jobs:
1920
- uses: actions/checkout@v3
2021
with:
2122
fetch-depth: 0
23+
24+
- name: Fetch all tags
25+
run: git fetch --tags --force
26+
27+
- name: Get latest tag
28+
id: get_latest_tag
29+
run: |
30+
LATEST_TAG=$(git tag | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)
31+
echo "Latest tag: $LATEST_TAG"
32+
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
33+
34+
- name: Calculate next version
35+
id: next_version
36+
run: |
37+
LATEST_TAG=${{ steps.get_latest_tag.outputs.latest_tag }}
38+
if [ -z "$LATEST_TAG" ]; then
39+
NEXT_TAG="v1.0.0"
40+
else
41+
# Extract version numbers
42+
VERSION=${LATEST_TAG#v}
43+
MAJOR=$(echo $VERSION | cut -d. -f1)
44+
MINOR=$(echo $VERSION | cut -d. -f2)
45+
PATCH=$(echo $VERSION | cut -d. -f3)
46+
47+
# Increment patch version
48+
PATCH=$((PATCH + 1))
49+
NEXT_TAG="v${MAJOR}.${MINOR}.${PATCH}"
50+
fi
51+
echo "Next tag: $NEXT_TAG"
52+
echo "next_tag=$NEXT_TAG" >> $GITHUB_OUTPUT
53+
2254
- name: Create GitHub Release
2355
id: create_release
24-
uses: zendesk/action-create-release@v1
56+
uses: actions/create-release@v1
2557
env:
2658
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2759
with:
28-
auto_increment_type: patch
60+
tag_name: ${{ steps.next_version.outputs.next_tag }}
61+
release_name: Release ${{ steps.next_version.outputs.next_tag }}
2962
prerelease: false
3063
draft: false
31-
tag_schema: semantic
3264

3365
build:
3466
needs: create_release
@@ -74,11 +106,20 @@ jobs:
74106
run: |
75107
cd helix-cli
76108
cargo build --release --target ${{ matrix.target }}
109+
- name: Rename binary
110+
run: |
111+
if [ "${{ matrix.os }}" == "windows-latest" ]; then
112+
mv helix-cli/target/${{ matrix.target }}/release/helix.exe ${{ matrix.binary_name }}
113+
else
114+
mv helix-cli/target/${{ matrix.target }}/release/helix ${{ matrix.binary_name }}
115+
fi
116+
shell: bash
117+
77118
- name: Upload Release Asset
78119
uses: actions/upload-release-asset@v1
79120
with:
80121
upload_url: ${{ needs.create_release.outputs.upload_url }}
81-
asset_path: target/${{ matrix.target }}/release/${{ matrix.os == 'windows-latest' && 'helix.exe' || 'helix' }}
122+
asset_path: ${{ matrix.binary_name }}
82123
asset_name: ${{ matrix.binary_name }}
83124
asset_content_type: application/octet-stream
84125
env:

0 commit comments

Comments
 (0)