@@ -89,38 +89,29 @@ jobs:
8989
9090 - name : Install Rust Binaries
9191 run : |
92- cargo binstall -y --force cargo-edit
92+ cargo binstall -y --force cargo-tag
9393 cargo binstall -y --force leptosfmt
9494 cargo binstall -y --force trunk
9595
96- - id : cargo-set-version
97- name : Set Version
96+ - name : Retrieve Version
9897 run : |
98+ git config --global user.name 'github-actions[bot]'
99+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
100+ cd ./src/http-server
99101 if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
100- cargo set-version -p http-server --bump ${{ inputs.version }}
102+ echo "CRATE_VERSION=$( cargo tag --no-commit --no-tag -p=v ${{ inputs.version }})" >> $GITHUB_ENV
101103 else
102- # For push events, add pre-release suffix
103- current_version=$(awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }' ./src/http-server/Cargo.toml | head -1)
104- pre_version="${current_version}-pre.$(date +%Y%m%d%H%M%S)"
105- cargo set-version -p http-server $pre_version
104+ echo "CRATE_VERSION=$(cargo tag --no-commit --no-tag -p=v pre.$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
106105 fi
107-
108- - name : Set Crate Version as Environment Variable
109- run : |
110- if [ "${{ matrix.os }}" == "macos-latest" ]; then
111- CARGO_TOML_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }' ./src/http-server/Cargo.toml | head -1)
112- else
113- CARGO_TOML_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }' ./src/http-server/Cargo.toml)
114- fi
115- echo "CRATE_VERSION=$CARGO_TOML_VERSION" >> $GITHUB_ENV
106+ git push origin main --follow-tags
116107
117108 - name : Build binary
118109 run : cargo build --release --target ${{ matrix.target }} -p http-server
119110
120111 - name : Package binary
121112 run : |
122113 # Create binary name with version and target
123- BINARY_NAME="http-server-v ${{ env.CRATE_VERSION }}-${{ matrix.name }}"
114+ BINARY_NAME="http-server-${{ env.CRATE_VERSION }}-${{ matrix.name }}"
124115
125116 # Copy and rename binary
126117 if [ "${{ matrix.os }}" == "ubuntu-latest" ] || [ "${{ matrix.os }}" == "macos-latest" ]; then
@@ -157,30 +148,16 @@ jobs:
157148 run : |
158149 cargo binstall -y --force cargo-edit
159150
160- - id : cargo-set-version
161- name : Set Version
151+ - name : Retrieve Version
162152 run : |
153+ git config --global user.name 'github-actions[bot]'
154+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
155+ cd ./src/http-server
163156 if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
164- cargo set-version -p http-server --bump ${{ inputs.version }}
157+ echo "CRATE_VERSION=$( cargo tag --no-commit --no-tag -p=v ${{ inputs.version }})" >> $GITHUB_ENV
165158 else
166- # For push events, add pre-release suffix
167- current_version=$(awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }' ./src/http-server/Cargo.toml)
168- pre_version="${current_version}-pre.$(date +%Y%m%d%H%M%S)"
169- cargo set-version -p http-server $pre_version
159+ echo "CRATE_VERSION=$(cargo tag --no-commit --no-tag -p=v pre.$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
170160 fi
171-
172- - name : Set Crate Version as Environment Variable
173- run : |
174- CARGO_TOML_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }' ./src/http-server/Cargo.toml)
175- echo "CRATE_VERSION=$CARGO_TOML_VERSION" >> $GITHUB_ENV
176-
177- - name : Create Commit
178- if : github.event_name == 'workflow_dispatch'
179- run : |
180- git config --global user.name 'github-actions[bot]'
181- git config --global user.email 'github-actions[bot]@users.noreply.github.com'
182- git add .
183- git commit -m "chore: bump version to v$CRATE_VERSION"
184161 git push origin main --follow-tags
185162
186163 - name : Login to Crates.io
@@ -211,8 +188,8 @@ jobs:
211188 fi
212189
213190 # Create the release
214- gh release create "v ${{ env.CRATE_VERSION }}" \
215- --title "Release v ${{ env.CRATE_VERSION }}" \
191+ gh release create "${{ env.CRATE_VERSION }}" \
192+ --title "Release ${{ env.CRATE_VERSION }}" \
216193 --generate-notes \
217194 $IS_PRERELEASE
218195
@@ -222,7 +199,7 @@ jobs:
222199 for file in "$artifact_dir"*.tar.gz; do
223200 if [ -f "$file" ]; then
224201 echo "Uploading $(basename "$file")"
225- gh release upload "v ${{ env.CRATE_VERSION }}" "$file"
202+ gh release upload "${{ env.CRATE_VERSION }}" "$file"
226203 fi
227204 done
228205 fi
0 commit comments