.github: Update workflows to use actions variables (#378)

Reference: https://github.com/hashicorp/terraform-devex-repos/issues/17
Reference: https://github.com/hashicorp/terraform-devex-repos/issues/35
This commit is contained in:
Brian Flad 2023-11-29 20:14:28 +01:00 committed by GitHub
parent b4be958214
commit 1f997cc1ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,10 +11,6 @@ on:
permissions: permissions:
contents: read # Changelog commit operations use service account PAT contents: read # Changelog commit operations use service account PAT
env:
CI_COMMIT_AUTHOR: hc-github-team-tf-provider-devex
CI_COMMIT_EMAIL: github-team-tf-provider-devex@hashicorp.com
jobs: jobs:
major-version: major-version:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -55,11 +51,11 @@ jobs:
args: merge args: merge
- name: Git push changelog - name: Git push changelog
run: | run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" git config --global user.name "${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" git config --global user.email "${{ vars.TF_DEVEX_CI_COMMIT_EMAIL }}"
git add . git add .
git commit -a -m "Update changelog" git commit -a -m "Update changelog"
git push "https://${{ env.CI_COMMIT_AUTHOR }}:${{ secrets.TF_DEVEX_COMMIT_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" git push "https://${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}:${{ secrets.TF_DEVEX_COMMIT_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
update-package-version: update-package-version:
needs: changelog needs: changelog
@ -84,11 +80,11 @@ jobs:
run: npm version "${{ inputs.versionNumber }}" --git-tag-version false run: npm version "${{ inputs.versionNumber }}" --git-tag-version false
- name: Git push - name: Git push
run: | run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" git config --global user.name "${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" git config --global user.email "${{ vars.TF_DEVEX_CI_COMMIT_EMAIL }}"
git add . git add .
git commit -a -m "Update package version" git commit -a -m "Update package version"
git push "https://${{ env.CI_COMMIT_AUTHOR }}:${{ secrets.TF_DEVEX_COMMIT_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" git push "https://${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}:${{ secrets.TF_DEVEX_COMMIT_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
release-tag: release-tag:
needs: [ update-package-version, major-version ] needs: [ update-package-version, major-version ]
@ -107,13 +103,13 @@ jobs:
- name: Git push release tag - name: Git push release tag
run: | run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" git config --global user.name "${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" git config --global user.email "${{ vars.TF_DEVEX_CI_COMMIT_EMAIL }}"
git tag "${{ inputs.versionNumber }}" git tag "${{ inputs.versionNumber }}"
git tag -f "${{ needs.major-version.outputs.version }}" git tag -f "${{ needs.major-version.outputs.version }}"
git push "https://${{ env.CI_COMMIT_AUTHOR }}:${{ secrets.TF_DEVEX_COMMIT_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" "${{ inputs.versionNumber }}" git push "https://${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}:${{ secrets.TF_DEVEX_COMMIT_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" "${{ inputs.versionNumber }}"
git push "https://${{ env.CI_COMMIT_AUTHOR }}:${{ secrets.TF_DEVEX_COMMIT_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" -f "${{ needs.major-version.outputs.version }}" git push "https://${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}:${{ secrets.TF_DEVEX_COMMIT_GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" -f "${{ needs.major-version.outputs.version }}"
release: release:
needs: [ changelog-version, release-tag ] needs: [ changelog-version, release-tag ]