Skip to content

chore: improve release workflow #60

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

Merged
merged 8 commits into from
Jul 31, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
makes sure we can run non-interactively in CI
  • Loading branch information
matifali committed Jul 31, 2024
commit 7ade03cfdcc64e448092f4cd9b89bd17ad5cda7d
17 changes: 9 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,18 @@ jobs:
set -euo pipefail
version=${{ steps.version.outputs.version }}

if gh release view $version; then
# check if release already exists and match the version
if [[ $(gh release view $version --json name -q '.name' | cat) == $version ]]; then
echo "Release $version already exists"
exit 0
fi

echo "Creating release $version"
# if version contains -rc, publish as a pre-release and don't set as latest
if [[ $version == *-rc* ]]; then
gh release create $version -t $version --generate-notes --prerelease --latest=false --verify-tag build/${version}.tgz#helm.tar.gz
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can remove else case and outdent below block due to exit 0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also discovered that the gh release view is interactive and ensured it could run noninteractively.

echo "Creating release $version"
# if version contains -rc, publish as a pre-release and not latest
if [[ $version == *-rc* ]]; then
gh release create $version -t $version --generate-notes --prerelease --latest=false --verify-tag build/${version}.tgz#helm.tar.gz
else
gh release create $version -t $version --generate-notes --verify-tag build/${version}.tgz#helm.tar.gz
fi
gh release create $version -t $version --generate-notes --verify-tag build/${version}.tgz#helm.tar.gz
fi
env:
GITHUB_TOKEN: ${{ github.token }}