-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: overall improvements to release scripts
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
- Loading branch information
Showing
7 changed files
with
183 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright 2021 The terraform-docs Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o errtrace | ||
|
||
NEW_VERSION=$1 | ||
TF_DOCS_VERSION=$2 | ||
|
||
PWD=$(cd "$(dirname "$0")" && pwd -P) | ||
|
||
if [ -z "${NEW_VERSION}" ]; then | ||
NEW_VERSION=$(grep "uses: terraform-docs/gh-actions" "${PWD}"/../../README.md | tr -s ' ' | uniq | cut -d"@" -f2) | ||
fi | ||
if [ -z "${NEW_VERSION}" ]; then | ||
echo "Usage: pre-release.sh <NEW_VERSION> <TF_DOCS_VERSION>" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${TF_DOCS_VERSION}" ]; then | ||
TF_DOCS_VERSION=$(grep "FROM quay.io/terraform-docs/terraform-docs" "${PWD}"/../Dockerfile | tr -s ' ' | uniq | cut -d":" -f2) | ||
fi | ||
if [ -z "${TF_DOCS_VERSION}" ]; then | ||
echo "Usage: pre-release.sh <NEW_VERSION> <TF_DOCS_VERSION>" | ||
exit 1 | ||
fi | ||
|
||
# Update README | ||
VERSION=v${NEW_VERSION//v/} TERRAFORM_DOCS_VERSION=v${TF_DOCS_VERSION//v/} \ | ||
gomplate \ | ||
-d action="${PWD}"/../../action.yml \ | ||
-f "${PWD}"/../../.github/templates/README.tpl \ | ||
-o "${PWD}"/../../README.md | ||
|
||
# Update Dockerfile | ||
sed -i -E "s|FROM quay.io/terraform-docs/terraform-docs:(.*)|FROM quay.io/terraform-docs/terraform-docs:${TF_DOCS_VERSION//v/}|g" "${PWD}"/../../Dockerfile | ||
|
||
# Update action.yml | ||
sed -i -E "s|docker://quay.io/terraform-docs/gh-actions:(.*)\"|docker://quay.io/terraform-docs/gh-actions:${NEW_VERSION//v/}\"|g" "${PWD}"/../../action.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: update-terraform-docs | ||
run-name: update terraform-docs to v${{ github.event.inputs.version }} | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tfdocs-version: | ||
description: "terraform-docs version (without leading v)" | ||
required: true | ||
type: string | ||
|
||
env: | ||
GOMPLATE_VERSION: "v3.8.0" | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[ci skip]')" | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
fetch-depth: 0 | ||
token: ${{ secrets.COMMITTER_TOKEN }} | ||
|
||
- name: Install gomplate | ||
run: | | ||
sudo curl -o /usr/local/bin/gomplate -sSL https://github.com/hairyhenderson/gomplate/releases/download/${{ env.GOMPLATE_VERSION }}/gomplate_linux-amd64 | ||
sudo chmod 755 /usr/local/bin/gomplate | ||
- name: Bump to terraform-docs v${{ inputs.tfdocs-version }} | ||
run: | | ||
./.github/scripts/prepare-release.sh "" ${{ inputs.tfdocs-version }} | ||
- name: Push terraform-docs v${{ inputs.tfdocs-version }} Changes | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.COMMITTER_TOKEN }} | ||
with: | ||
file_pattern: "README.md Dockerfile" | ||
commit_message: "chore: bump terraform-docs to v${{ inputs.tfdocs-version }}" | ||
commit_user_name: terraform-docs-bot | ||
commit_user_email: bot@terraform-docs.io | ||
commit_author: "terraform-docs-bot <bot@terraform-docs.io>" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters