Refactor Github Action per b/485167538

This commit is contained in:
Ben Knutson
2026-02-18 16:50:42 +00:00
committed by Wiktor Niesiobędzki
parent 60ec6db9cd
commit 490d49bd3a
3 changed files with 17 additions and 12 deletions

View File

@@ -52,11 +52,11 @@ runs:
- name: Configure provider cache
shell: bash
run: |
echo 'plugin_cache_dir = "${{ env.TF_PLUGIN_CACHE_DIR }}"' \
echo 'plugin_cache_dir = "${TF_PLUGIN_CACHE_DIR}"' \
| tee -a /home/runner/.terraformrc
echo 'disable_checkpoint = true' \
| tee -a /home/runner/.terraformrc
mkdir -p ${{ env.TF_PLUGIN_CACHE_DIR }}
mkdir -p ${TF_PLUGIN_CACHE_DIR}
- name: Download lockfile
uses: actions/download-artifact@v4
with:

View File

@@ -39,11 +39,16 @@ jobs:
- name: "Validate input"
# yamllint disable rule:line-length
run: |
[[ "${{ github.event.inputs.changelog }}" != "true" ]] && { echo 'You didn''t update the changelog.' ; exit 1; }
[[ -n "${{ github.event.inputs.version }}" ]] || { echo 'Version not specified!'; exit 1; }
[[ "${{ github.event.inputs.version }}" != v* ]] && { echo 'Version does not start with v!' ; exit 1; }
[[ "${GITHUB_EVENT_INPUTS_CHANGELOG}" != "true" ]] && { echo 'You didn''t update the changelog.' ; exit 1; }
[[ -n "${GITHUB_EVENT_INPUTS_VERSION}" ]] || { echo 'Version not specified!'; exit 1; }
[[ "${GITHUB_EVENT_INPUTS_VERSION}" != v* ]] && { echo 'Version does not start with v!' ; exit 1; }
env:
GITHUB_EVENT_INPUTS_CHANGELOG: ${{ github.event.inputs.changelog }}
GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }}
- name: "Tag and release"
run: |
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}
git tag ${GITHUB_EVENT_INPUTS_VERSION}
git push origin ${GITHUB_EVENT_INPUTS_VERSION}
env:
GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }}

View File

@@ -57,7 +57,7 @@ jobs:
run: |
set -e -o xtrace
if [[ ${{ matrix.flavour }} == 'terraform' ]] ; then
echo TERRAFORM_VERSION=${{ env.DEFAULT_TERRAFORM_VERSION }} | tee -a ${GITHUB_ENV}
echo TERRAFORM_VERSION=${DEFAULT_TERRAFORM_VERSION} | tee -a ${GITHUB_ENV}
elif [[ ${{ matrix.flavour }} == 'tofu' ]] ; then
echo TERRAFORM_VERSION=${{ env.DEFAULT_TOFU_VERSION }} | tee -a ${GITHUB_ENV}
else
@@ -85,7 +85,7 @@ jobs:
sed -i -e 's/>=\(.*# tftest\)/=\1/g' tools/lockfile/versions.tf tools/lockfile/versions.tofu
# change terraform version to the one that is running
sed -i 's/required_version = .*$/required_version = ">= ${{ env.TERRAFORM_VERSION }}"/g' \
sed -i 's/required_version = .*$/required_version = ">= ${TERRAFORM_VERSION}"/g' \
tools/lockfile/versions.tf
cd tools/lockfile
@@ -145,7 +145,7 @@ jobs:
run: |
set -e -o xtrace
if [[ ${{ matrix.flavour }} == 'terraform' ]] ; then
echo TERRAFORM_VERSION=${{ env.DEFAULT_TERRAFORM_VERSION }} | tee -a ${GITHUB_ENV}
echo TERRAFORM_VERSION=${DEFAULT_TERRAFORM_VERSION} | tee -a ${GITHUB_ENV}
elif [[ ${{ matrix.flavour }} == 'tofu' ]] ; then
echo TERRAFORM_VERSION=${{ env.DEFAULT_TOFU_VERSION }} | tee -a ${GITHUB_ENV}
else
@@ -189,7 +189,7 @@ jobs:
run: |
set -e -o xtrace
if [[ ${{ matrix.flavour }} == 'terraform' ]] ; then
echo TERRAFORM_VERSION=${{ env.DEFAULT_TERRAFORM_VERSION }} | tee -a ${GITHUB_ENV}
echo TERRAFORM_VERSION=${DEFAULT_TERRAFORM_VERSION} | tee -a ${GITHUB_ENV}
elif [[ ${{ matrix.flavour }} == 'tofu' ]] ; then
echo TERRAFORM_VERSION=${{ env.DEFAULT_TOFU_VERSION }} | tee -a ${GITHUB_ENV}
else
@@ -233,7 +233,7 @@ jobs:
run: |
set -e -o xtrace
if [[ ${{ matrix.flavour }} == 'terraform' ]] ; then
echo TERRAFORM_VERSION=${{ env.DEFAULT_TERRAFORM_VERSION }} | tee -a ${GITHUB_ENV}
echo TERRAFORM_VERSION=${DEFAULT_TERRAFORM_VERSION} | tee -a ${GITHUB_ENV}
elif [[ ${{ matrix.flavour }} == 'tofu' ]] ; then
echo TERRAFORM_VERSION=${{ env.DEFAULT_TOFU_VERSION }} | tee -a ${GITHUB_ENV}
else