Skip to content

Commit 04fb226

Browse files
authored
Merge pull request #21 from swarit-stepsecurity/swarit/fix/ci-fails
fix(ci): find path for windows binary
2 parents 7263c43 + 2b94cf2 commit 04fb226

1 file changed

Lines changed: 31 additions & 13 deletions

File tree

.github/workflows/release.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,32 @@ jobs:
6565
env:
6666
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6767

68+
- name: Resolve draft release tag
69+
id: release
70+
env:
71+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
run: |
73+
# GoReleaser creates draft releases under an "untagged-*" slug,
74+
# so gh release upload by version tag returns 404. Look up the
75+
# actual tag GitHub assigned to the draft.
76+
release_tag=$(gh api "repos/${{ github.repository }}/releases" \
77+
--jq '[.[] | select(.draft and .name == "${{ steps.version.outputs.tag }}")] | first | .tag_name')
78+
if [ -z "$release_tag" ] || [ "$release_tag" = "null" ]; then
79+
echo "::error::Could not find draft release for ${{ steps.version.outputs.tag }}"
80+
exit 1
81+
fi
82+
echo "tag=$release_tag" >> "$GITHUB_OUTPUT"
83+
echo "Resolved draft release tag: $release_tag"
84+
6885
- name: Install cosign
6986
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
7087

7188
- name: Locate binaries
7289
id: binaries
7390
run: |
7491
DARWIN=$(find dist -type f -name '*darwin_unnotarized' | head -1)
75-
WIN_AMD64=$(find dist -type f -name '*windows_amd64.exe' | head -1)
76-
WIN_ARM64=$(find dist -type f -name '*windows_arm64.exe' | head -1)
92+
WIN_AMD64=$(find dist -type f -name '*.exe' -path '*windows_amd64*' | head -1)
93+
WIN_ARM64=$(find dist -type f -name '*.exe' -path '*windows_arm64*' | head -1)
7794
7895
for label in "darwin:${DARWIN}" "windows_amd64:${WIN_AMD64}" "windows_arm64:${WIN_ARM64}"; do
7996
name="${label%%:*}"
@@ -91,22 +108,23 @@ jobs:
91108
92109
- name: Sign artifacts with Sigstore
93110
run: |
94-
for artifact in \
95-
"${{ steps.binaries.outputs.darwin }}" \
96-
"${{ steps.binaries.outputs.win_amd64 }}" \
97-
"${{ steps.binaries.outputs.win_arm64 }}" \
98-
stepsecurity-dev-machine-guard.sh; do
99-
cosign sign-blob "$artifact" --bundle "${artifact}.bundle" --yes
100-
done
111+
cosign sign-blob "${{ steps.binaries.outputs.darwin }}" \
112+
--bundle dist/stepsecurity-dev-machine-guard-darwin_unnotarized.bundle --yes
113+
cosign sign-blob "${{ steps.binaries.outputs.win_amd64 }}" \
114+
--bundle dist/stepsecurity-dev-machine-guard-windows_amd64.exe.bundle --yes
115+
cosign sign-blob "${{ steps.binaries.outputs.win_arm64 }}" \
116+
--bundle dist/stepsecurity-dev-machine-guard-windows_arm64.exe.bundle --yes
117+
cosign sign-blob stepsecurity-dev-machine-guard.sh \
118+
--bundle dist/stepsecurity-dev-machine-guard.sh.bundle --yes
101119
102120
- name: Upload cosign bundles
103121
env:
104122
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105123
run: |
106-
gh release upload "${{ steps.version.outputs.tag }}" \
107-
"${{ steps.binaries.outputs.darwin }}.bundle" \
108-
"${{ steps.binaries.outputs.win_amd64 }}.bundle" \
109-
"${{ steps.binaries.outputs.win_arm64 }}.bundle" \
124+
gh release upload "${{ steps.release.outputs.tag }}" \
125+
dist/stepsecurity-dev-machine-guard-darwin_unnotarized.bundle \
126+
dist/stepsecurity-dev-machine-guard-windows_amd64.exe.bundle \
127+
dist/stepsecurity-dev-machine-guard-windows_arm64.exe.bundle \
110128
dist/stepsecurity-dev-machine-guard.sh.bundle \
111129
--clobber
112130

0 commit comments

Comments
 (0)