Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Migrate to GitHub CLI tool #468

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/post-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:

- name: Create or Update Release
env:
# Required for the `hub` CLI
# Required for the GitHub CLI
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./build/github-release.sh --asset-dir=./_release/${TAG_NAME#v}/ --tag=${TAG_NAME}
9 changes: 4 additions & 5 deletions build/github-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ done
# Collect a list of opa-envoy binaries
ASSETS=()
for asset in "${ASSET_DIR}"/opa_envoy_*_*; do
ASSETS+=("-a" "$asset")
ASSETS+=("$asset")
done

# Prepare the release notes
Expand All @@ -45,11 +45,10 @@ LINE="See the OPA ${TAG_NAME} release notes."
echo -e "${LINE}" >> "${RELEASE_NOTES}"

# Update or create a release on github
if hub release show "${TAG_NAME}" > /dev/null; then
if gh release view "${TAG_NAME}" --repo open-policy-agent/opa-envoy-plugin > /dev/null; then
# Occurs when the tag is created via GitHub UI w/ a release
# Use -m "" to preserve the existing text.
hub release edit "${ASSETS[@]}" -m "" "${TAG_NAME}"
gh release upload "${TAG_NAME}" "${ASSETS[@]}" --repo open-policy-agent/opa-envoy-plugin
else
# Create a draft release
hub release create "${ASSETS[@]}" -F ${RELEASE_NOTES} --draft "${TAG_NAME}"
gh release create "${TAG_NAME}" "${ASSETS[@]}" -F ${RELEASE_NOTES} --draft --title "${TAG_NAME}" --repo open-policy-agent/opa-envoy-plugin
fi