@@ -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
5653 needs : [test]
5754
5855 steps :
59- - uses : actions/checkout@v4
60- with :
61- fetch-depth : 0
56+ - name : Checkout repository
57+ run : |
58+ rm -rf .git
59+ git init .
60+ git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git"
61+ git fetch --force --tags origin "+refs/heads/*:refs/remotes/origin/*"
62+ git fetch --force origin "${{ github.sha }}"
63+ git checkout --detach FETCH_HEAD
6264
6365 - name : Get version
6466 id : version
@@ -83,19 +85,31 @@ jobs:
8385 echo "EOF" >> $GITHUB_OUTPUT
8486
8587 - name : Create Release
86- uses : softprops/action-gh-release@v1
87- with :
88- name : v${{ steps.version.outputs.version }}
89- body : |
90- ## What's Changed
91-
92- ${{ steps.changelog.outputs.changelog }}
93-
94- ## Installation
95-
96- ```toml
97- [dependencies]
98- solverforge-ui = "${{ steps.version.outputs.version }}"
99- ```
100- draft : false
101- prerelease : ${{ contains(steps.version.outputs.version, '-') }}
88+ env :
89+ GITHUB_TOKEN : ${{ github.token }}
90+ run : |
91+ cat <<'EOF' > release-notes.md
92+ ## What's Changed
93+
94+ ${{ steps.changelog.outputs.changelog }}
95+
96+ ## Installation
97+
98+ ```toml
99+ [dependencies]
100+ solverforge-ui = "${{ steps.version.outputs.version }}"
101+ ```
102+ EOF
103+
104+ release_args=(
105+ "v${{ steps.version.outputs.version }}"
106+ --target "${{ github.sha }}"
107+ --title "v${{ steps.version.outputs.version }}"
108+ --notes-file release-notes.md
109+ )
110+
111+ if [[ "${{ steps.version.outputs.version }}" == *-* ]]; then
112+ release_args+=(--prerelease)
113+ fi
114+
115+ gh release create "${release_args[@]}"
0 commit comments