Skip to content

Commit

Permalink
ci: update version in docs & sec pol on release (#1293)
Browse files Browse the repository at this point in the history
jthegedus authored Jul 12, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 5733bc2 commit ce16c63
Showing 7 changed files with 46 additions and 26 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/docs-version.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: On Release

on:
push:
tags:
- '*'

jobs:
bump-versions-in-docs:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
with:
ref: "refs/heads/master"
- name: replace version in getting-started docs
run: scripts/update_version_in_docs.bash
- name: replace version in security policy support list
run: scripts/update_version_list_in_security_policy.bash
- name: commit docs version update
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "docs: update version in install instructions & security policy"
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ on:
pull_request:

env:
BATS_VERSION: v1.7.0
ELVISH_VERSION: v0.18.0

jobs:
@@ -50,7 +49,7 @@ jobs:
- name: Install bats
run: |
git clone --depth 1 --branch "${{ env.BATS_VERSION }}" https://github.com/bats-core/bats-core.git $HOME/bats-core
git clone --depth 1 --branch "v$(grep -Eo "^\\s*bats\\s*.*$" ".tool-versions" | cut -d ' ' -f2-)" https://github.com/bats-core/bats-core.git $HOME/bats-core
echo "$HOME/bats-core/bin" >>"$GITHUB_PATH"
- name: Run tests
2 changes: 2 additions & 0 deletions scripts/shellcheck.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

exec shellcheck -s bash -x \
asdf.sh \
completions/*.bash \
2 changes: 2 additions & 0 deletions scripts/shfmt.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

set -euo pipefail

exec shfmt -d .
6 changes: 6 additions & 0 deletions scripts/update_version_in_docs.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -euo pipefail

version=$(cat version.txt)
sed -i "s/\\(git clone.*--branch \\).*\\(\`.*|\\)/\\1v$version\\2/" docs/guide/getting-started.md
12 changes: 12 additions & 0 deletions scripts/update_version_list_in_security_policy.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -euo pipefail

version_major_minor_x="$(cut -f1-2 -d "." version.txt).x"

# skip if version is already in the list
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
fi

0 comments on commit ce16c63

Please sign in to comment.