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

This commit is contained in:
James Hegedus 2022-07-13 01:07:59 +10:00 committed by GitHub
parent 5733bc2fc4
commit ce16c638b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 26 deletions

View File

@ -1,24 +0,0 @@
name: "Docs Version Update"
on:
push:
tags:
- '*'
jobs:
bump-version-in-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: checkout repo
with:
ref: "refs/heads/master"
- run: sed -i "s|^\\(git clone.*--branch \\).*$|\\1v$(cat version.txt)|" docs/guide/getting-started.md
name: replace version in docs
- uses: stefanzweifel/git-auto-commit-action@v4
name: commit docs version update
with:
commit_message: "docs: update version in install instructions"

23
.github/workflows/on-release.yml vendored Normal file
View File

@ -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"

View File

@ -7,7 +7,6 @@ on:
pull_request: pull_request:
env: env:
BATS_VERSION: v1.7.0
ELVISH_VERSION: v0.18.0 ELVISH_VERSION: v0.18.0
jobs: jobs:
@ -50,7 +49,7 @@ jobs:
- name: Install bats - name: Install bats
run: | 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" echo "$HOME/bats-core/bin" >>"$GITHUB_PATH"
- name: Run tests - name: Run tests

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail
exec shellcheck -s bash -x \ exec shellcheck -s bash -x \
asdf.sh \ asdf.sh \
completions/*.bash \ completions/*.bash \

View File

@ -1,3 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail
exec shfmt -d . exec shfmt -d .

View File

@ -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

View File

@ -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