Bump Provider and Module Versions #662
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
name: Bump Provider and Module Versions | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: The environment of the Registry | |
options: | |
- Development | |
- Production | |
workflow_call: | |
inputs: | |
environment: | |
type: string | |
description: The environment of the Registry | |
jobs: | |
bump-versions: | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ inputs.environment }} | |
permissions: | |
contents: write | |
actions: write | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: './src/go.mod' | |
- name: Run version bump script | |
working-directory: ./src | |
run: go run ./cmd/bump-versions | |
- name: Get branch | |
id: get-branch | |
run: | | |
if [ "${{ inputs.environment }}" = "Production" ]; then | |
export BRANCH="${{ github.ref }}" | |
elif [ "${{ inputs.environment }}" = "Development" ]; then | |
TIMESTAMP=$(date +%s) | |
export BRANCH="${{ github.ref }}-bump-versions-$TIMESTAMP" | |
fi | |
echo "BRANCH=$BRANCH" >> $GITHUB_ENV | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
file_pattern: 'modules/**/* providers/**/*' | |
commit_author: OpenTofu Core Development Team <[email protected]> | |
commit_user_name: OpenTofu Core Development Team | |
commit_message: "Automated bump of versions for providers and modules" | |
create_branch: true | |
branch: ${{ env.BRANCH }} | |
- name: Print Branch name | |
run: | | |
echo "Providers and modules changes were pushed to branch: ${{ env.BRANCH }}" |