@@ -107,11 +107,18 @@ jobs:
107107 id : tag
108108 run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
109109
110- - name : Generate changelog from git history
111- uses : orhun/git-cliff-action@v3
110+ - name : Install Rust toolchain (for git-cliff)
111+ uses : dtolnay/rust-toolchain@master
112112 with :
113- config : .gitcliff.toml
114- args : --tag ${{ steps.tag.outputs.VERSION }} --output release-notes.md
113+ toolchain : stable
114+
115+ - name : Install git-cliff
116+ run : |
117+ cargo install --locked git-cliff
118+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
119+
120+ - name : Generate changelog from git history
121+ run : git-cliff --config .gitcliff.toml --tag ${{ steps.tag.outputs.VERSION }} --output release-notes.md
115122 env :
116123 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
117124
@@ -121,17 +128,8 @@ jobs:
121128 | sort -z \
122129 | xargs -0 sha256sum > checksums.txt
123130
124- - name : Check if Homebrew token is set
125- id : check_token
126- run : |
127- if [ -n "${{ secrets.HOMEBREW_TAP_TOKEN }}" ]; then
128- echo "token_set=true" >> $GITHUB_OUTPUT
129- else
130- echo "token_set=false" >> $GITHUB_OUTPUT
131- fi
132-
133131 - name : Generate Homebrew formula and push tap
134- if : steps.check_token.outputs.token_set == 'true'
132+ if : " ${{ env.HOMEBREW_TAP_TOKEN != '' }} "
135133 env :
136134 VERSION : ${{ steps.tag.outputs.VERSION }}
137135 HOMEBREW_TAP_TOKEN : ${{ secrets.HOMEBREW_TAP_TOKEN }}
@@ -140,12 +138,12 @@ jobs:
140138 TAR_URL="https://github.com/ruphy/sshdb/archive/refs/tags/v${VERSION}.tar.gz"
141139 SHA256=$(curl -L "$TAR_URL" | shasum -a 256 | awk '{print $1}')
142140
143- mkdir -p /tmp/tap
141+ TAP_DIR=$(mktemp -d)
144142 git config --global user.name "sshdb-release-bot"
145143 git config --global user.email "[email protected] " 146- git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/ruphy/homebrew-sshdb" /tmp/tap
144+ git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/ruphy/homebrew-sshdb" "${TAP_DIR}"
147145
148- cat > /tmp/tap/ Formula/sshdb.rb <<EOF
146+ cat > "${TAP_DIR}/ Formula/sshdb.rb" <<EOF
149147 class Sshdb < Formula
150148 desc "Keyboard-first SSH library and launcher TUI"
151149 homepage "https://github.com/ruphy/sshdb"
@@ -164,12 +162,13 @@ jobs:
164162 end
165163 EOF
166164
167- cd /tmp/tap
165+ cd "${TAP_DIR}"
168166 git add Formula/sshdb.rb
169- if git commit -m "sshdb ${VERSION}"; then
170- git push origin HEAD:main
171- else
167+ if git diff --cached --quiet; then
172168 echo "No changes to commit for tap."
169+ else
170+ git commit -m "sshdb ${VERSION}"
171+ git push origin HEAD:main
173172 fi
174173
175174 - name : Create Release
0 commit comments