@@ -101,28 +101,44 @@ jobs:
101101 publish-homebrew :
102102 runs-on : ubuntu-24.04
103103 needs : build-manifests
104- if : ${{ secrets.HOMEBREW_TAP_TOKEN != '' }}
105104 steps :
105+ - name : Check Homebrew publish credentials
106+ id : gate
107+ env :
108+ HOMEBREW_TAP_TOKEN : ${{ secrets.HOMEBREW_TAP_TOKEN }}
109+ run : |
110+ if [[ -n "${HOMEBREW_TAP_TOKEN:-}" ]]; then
111+ echo "publish=true" >> "$GITHUB_OUTPUT"
112+ else
113+ echo "publish=false" >> "$GITHUB_OUTPUT"
114+ echo "Skipping Homebrew publish: HOMEBREW_TAP_TOKEN is not configured."
115+ fi
116+
106117 - uses : actions/checkout@v4
118+ if : steps.gate.outputs.publish == 'true'
107119
108120 - uses : actions/download-artifact@v4
121+ if : steps.gate.outputs.publish == 'true'
109122 with :
110123 name : package-managers-rendered
111124 path : .stage/package-managers/rendered
112125
113126 - name : Checkout tap repo
127+ if : steps.gate.outputs.publish == 'true'
114128 uses : actions/checkout@v4
115129 with :
116130 repository : nilstate/homebrew-tap
117131 token : ${{ secrets.HOMEBREW_TAP_TOKEN }}
118132 path : .stage/homebrew-tap
119133
120134 - name : Publish formula
135+ if : steps.gate.outputs.publish == 'true'
121136 env :
122137 TAP_REPO_DIR : ${{ github.workspace }}/.stage/homebrew-tap
123138 run : ./scripts/publish-homebrew.sh
124139
125140 - name : Commit formula update
141+ if : steps.gate.outputs.publish == 'true'
126142 run : |
127143 git -C .stage/homebrew-tap config user.name "github-actions[bot]"
128144 git -C .stage/homebrew-tap config user.email "41898282+github-actions[bot]@users.noreply.github.com"
@@ -136,16 +152,30 @@ jobs:
136152 publish-aur :
137153 runs-on : ubuntu-24.04
138154 needs : build-manifests
139- if : ${{ secrets.AUR_SSH_PRIVATE_KEY != '' }}
140155 steps :
156+ - name : Check AUR publish credentials
157+ id : gate
158+ env :
159+ AUR_SSH_PRIVATE_KEY : ${{ secrets.AUR_SSH_PRIVATE_KEY }}
160+ run : |
161+ if [[ -n "${AUR_SSH_PRIVATE_KEY:-}" ]]; then
162+ echo "publish=true" >> "$GITHUB_OUTPUT"
163+ else
164+ echo "publish=false" >> "$GITHUB_OUTPUT"
165+ echo "Skipping AUR publish: AUR_SSH_PRIVATE_KEY is not configured."
166+ fi
167+
141168 - uses : actions/checkout@v4
169+ if : steps.gate.outputs.publish == 'true'
142170
143171 - uses : actions/download-artifact@v4
172+ if : steps.gate.outputs.publish == 'true'
144173 with :
145174 name : package-managers-rendered
146175 path : .stage/package-managers/rendered
147176
148177 - name : Configure SSH
178+ if : steps.gate.outputs.publish == 'true'
149179 run : |
150180 install -m 700 -d ~/.ssh
151181 printf '%s\n' "${AUR_SSH_PRIVATE_KEY}" > ~/.ssh/aur
@@ -155,16 +185,19 @@ jobs:
155185 AUR_SSH_PRIVATE_KEY : ${{ secrets.AUR_SSH_PRIVATE_KEY }}
156186
157187 - name : Checkout AUR package
188+ if : steps.gate.outputs.publish == 'true'
158189 run : git clone ssh://aur@aur.archlinux.org/icey-server.git .stage/aur-repo
159190 env :
160191 GIT_SSH_COMMAND : ssh -i ~/.ssh/aur -o IdentitiesOnly=yes
161192
162193 - name : Publish AUR package
194+ if : steps.gate.outputs.publish == 'true'
163195 env :
164196 AUR_REPO_DIR : ${{ github.workspace }}/.stage/aur-repo
165197 run : ./scripts/publish-aur.sh
166198
167199 - name : Commit AUR update
200+ if : steps.gate.outputs.publish == 'true'
168201 run : |
169202 git -C .stage/aur-repo config user.name "github-actions[bot]"
170203 git -C .stage/aur-repo config user.email "41898282+github-actions[bot]@users.noreply.github.com"
0 commit comments