Skip to content

Commit 6d8d96e

Browse files
authored
fix: ci and release script (#9)
1 parent 69f6655 commit 6d8d96e

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
asset_name: windows
3535
arch: x86_64
3636
env:
37-
BINARY_NAME: zparse-${{ matrix.platform.asset_name }}-${{ matrix.platform.arch }}${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }}
37+
BINARY_NAME: keywatch-${{ matrix.platform.asset_name }}-${{ matrix.platform.arch }}${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }}
3838

3939
steps:
4040
- name: Checkout repository
@@ -69,15 +69,15 @@ jobs:
6969
# Build the specific package
7070
- name: Build Binary
7171
run: |
72-
cargo build --release --target ${{ matrix.platform.target }} -p zparse
72+
cargo build --release --target ${{ matrix.platform.target }}
7373
env:
7474
CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER: aarch64-apple-darwin-gcc
7575

7676
- name: Prepare Asset
7777
shell: bash
7878
run: |
7979
mkdir -p release
80-
cp target/${{ matrix.platform.target }}/release/zparse${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }} \
80+
cp target/${{ matrix.platform.target }}/release/key-watch${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }} \
8181
release/${{ env.BINARY_NAME }}
8282
8383
# Create checksum
@@ -94,7 +94,7 @@ jobs:
9494
- name: Create Release
9595
uses: softprops/action-gh-release@v1
9696
with:
97-
name: "zParse ${{ github.ref_name }}"
97+
name: "KeyWatch ${{ github.ref_name }}"
9898
files: |
9999
release/${{ env.BINARY_NAME }}
100100
release/${{ env.BINARY_NAME }}.sha256

scripts/release.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ read -p "Do you want to commit these changes and create tag v$VERSION? (y/n) " -
4343
echo
4444
if [[ $REPLY =~ ^[Yy]$ ]]
4545
then
46+
# Stash current changes and checkout to release branch
47+
git stash
48+
git checkout -b release-$VERSION
49+
git stash pop
50+
4651
# Commit changes
4752
git add Cargo.toml CHANGELOG.md
4853
git commit -m "chore: release version $VERSION"
@@ -51,8 +56,12 @@ then
5156
git tag -a "v$VERSION" -m "KeyWatch v$VERSION"
5257

5358
echo "Pushing changes..."
54-
git push origin main "v$VERSION"
55-
59+
git push origin release-$VERSION "v$VERSION"
60+
61+
# Checkout to main branch and delete release branch
62+
git checkout main
63+
git branch -D release-$VERSION
64+
5665
echo "KeyWatch release v$VERSION prepared and pushed!"
5766
else
5867
# Revert changes if user doesn't confirm

0 commit comments

Comments
 (0)