@@ -22,22 +22,19 @@ jobs:
2222 runs-on : ubuntu-latest
2323
2424 steps :
25- - uses : actions/checkout@v4
25+ - name : Checkout repository
26+ run : |
27+ rm -rf .git
28+ git init .
29+ git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git"
30+ git fetch --depth=1 origin "${{ github.sha }}"
31+ git checkout --detach FETCH_HEAD
2632
2733 - name : Install Rust
2834 run : |
2935 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
3036 echo "$HOME/.cargo/bin" >> $GITHUB_PATH
3137
32- - name : Cache cargo
33- uses : actions/cache@v4
34- with :
35- path : |
36- ~/.cargo/registry
37- ~/.cargo/git
38- target
39- key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
40-
4138 - name : Check formatting
4239 run : cargo fmt --all -- --check
4340
5855 needs : [test]
5956
6057 steps :
61- - uses : actions/checkout@v4
62- with :
63- fetch-depth : 0
58+ - name : Checkout repository
59+ run : |
60+ rm -rf .git
61+ git init .
62+ git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git"
63+ git fetch --force --tags origin "+refs/heads/*:refs/remotes/origin/*"
64+ git fetch --force origin "${{ github.sha }}"
65+ git checkout --detach FETCH_HEAD
6466
6567 - name : Get version
6668 id : version
@@ -89,19 +91,32 @@ jobs:
8991 echo "EOF" >> $GITHUB_OUTPUT
9092
9193 - name : Create Release
92- uses : softprops/action-gh-release@v1
93- with :
94- name : v${{ steps.version.outputs.version }}
95- body : |
96- ## What's Changed
97-
98- ${{ steps.changelog.outputs.changelog }}
99-
100- ## Installation
101-
102- ```toml
103- [dependencies]
104- solverforge-ui = "${{ steps.version.outputs.version }}"
105- ```
106- draft : false
107- prerelease : ${{ contains(steps.version.outputs.version, '-') }}
94+ env :
95+ GITHUB_TOKEN : ${{ github.token }}
96+ run : |
97+ cat <<'EOF' > release-notes.md
98+ ## What's Changed
99+
100+ ${{ steps.changelog.outputs.changelog }}
101+
102+ ## Installation
103+
104+ ```toml
105+ [dependencies]
106+ solverforge-ui = "${{ steps.version.outputs.version }}"
107+ ```
108+ EOF
109+
110+ release_args=(
111+ "v${{ steps.version.outputs.version }}"
112+ --target "${{ github.sha }}"
113+ --title "v${{ steps.version.outputs.version }}"
114+ --notes-file release-notes.md
115+ --verify-tag
116+ )
117+
118+ if [[ "${{ steps.version.outputs.version }}" == *-* ]]; then
119+ release_args+=(--prerelease)
120+ fi
121+
122+ gh release create "${release_args[@]}"
0 commit comments