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

ci: update version in docs & sec pol on release #1293

Merged
merged 6 commits into from Jul 12, 2022

Conversation

jthegedus
Copy link
Contributor

@jthegedus jthegedus commented Jul 12, 2022

Summary

  • fix sed for replacing version in docs/guide/getting-started page. Move to standalone script for easier dev testing
  • add script for prepending new version in sec policy. This script will only prepend if a new major.minor version is found as the current list does not track patch releases. Exec this script in the same CI pipeline as documentation version update so there is only a single auto-commit and avoid potential git race conditions of multiple updates from different jobs or workflows.
  • use bash strict mode in scripts/ files
  • in test/yml use Bats version from repo .tool-versions file and not hardcoded in tests workflow (we're not installing deps in the test.yml workflow via the asdf GH Action as it conflicts with tests somehow/somewhere. probably worth fixing one day).

Other Information

I believe this will fix the issues with auto-docs updating defined in #1000 & trigger fixed in #1232

@jthegedus jthegedus requested a review from a team as a code owner July 12, 2022 13:46
@jthegedus jthegedus changed the title ci: update ci: update version in docs & sec pol on release Jul 12, 2022
set -euo pipefail

version=$(cat version.txt)
sed -i "s/\\(git clone.*--branch \\).*\\(\`.*|\\)/\\1v$version\\2/" docs/guide/getting-started.md
Copy link
Member

Choose a reason for hiding this comment

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

Does $version need to be escaped before being used in the sed expression?

Copy link
Contributor Author

@jthegedus jthegedus Jul 12, 2022

Choose a reason for hiding this comment

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

In this case no (works locally 😅), I am no sed expert but perhaps it is because it's in the RHS of the substitution?

Copy link
Member

Choose a reason for hiding this comment

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

Ah yeah, on the RHS I guess we don't have to worry about . becoming a wildcard.

@jthegedus jthegedus merged commit ce16c63 into master Jul 12, 2022
@jthegedus jthegedus deleted the ci/auto-update-sec-policy-supported-list branch July 12, 2022 15:08
if ! grep -q "$version_major_minor_x" SECURITY.md; then
# prepend new version to the list
sed -i "s/white_check_mark:/x: /g" SECURITY.md
sed -i "s/^\\(| -* | -* |\\)$/\\1\\n| $version_major_minor_x | :white_check_mark: |/" SECURITY.md
Copy link
Contributor Author

@jthegedus jthegedus Jul 12, 2022

Choose a reason for hiding this comment

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

The whitespace for the newline is not perfect, but not too messy and the markdown rendering of GitHub resolves the table correctly regardless of whitespace. It's not perfect as version # character length changes across versions 0.9.0 => 0.10.0 etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants