Upgrade provider #43
This file contains hidden or 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: Upgrade provider | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| on: | |
| issues: | |
| types: | |
| - opened | |
| workflow_dispatch: {} | |
| env: | |
| GH_TOKEN: ${{ secrets.PR_TOKEN }} | |
| GO_VERSION: "1.24" | |
| jobs: | |
| upgrade_provider: | |
| if: ${{ (contains(github.event.issue.title, 'Upgrade terraform-provider-')) || github.event_name == 'workflow_dispatch' }} | |
| name: upgrade-provider | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6.0.1 | |
| # TODO: remove when this repo is made public | |
| - name: Configure Git for Private Modules | |
| run: | | |
| git config --global url."https://oauth2:${{ secrets.PR_TOKEN }}@github.com".insteadOf "https://github.com" | |
| # Sets GOPRIVATE and GONOSUMDB in order to use the git authetnication for go mod. | |
| echo "GOPRIVATE=github.com/${{ github.repository }}/*,github.com/stackitcloud/*" >> $GITHUB_ENV | |
| echo "GONOSUMDB=github.com/${{ github.repository }}/*,github.com/stackitcloud/*" >> $GITHUB_ENV | |
| # TODO: remove end | |
| - name: Unshallow clone for tags | |
| run: git fetch --prune --unshallow --tags | |
| - name: Install Go Tools | |
| uses: ./.github/actions/gotools | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Install Pulumi Tools | |
| uses: ./.github/actions/pulumitools | |
| - name: Get latest tag from terraform-provider-stackit and update the pulumi provider and bridge | |
| run: | | |
| git config user.name "Pulumi Generator Bot" | |
| git config user.email "noreply@stackit.de" | |
| LATEST_TAG=$(git ls-remote --tags https://github.com/stackitcloud/terraform-provider-stackit | grep -oP 'refs/tags/v\d+\.\d+\.\d+$' |sed 's/refs\/tags\///' | sort -V | tail -n 1) | |
| BRANCH_NAME="upgrade-terraform-provider-stackit-to-$LATEST_TAG" | |
| git checkout -b "$BRANCH_NAME" | |
| (cd provider && go get github.com/stackitcloud/terraform-provider-stackit@"$LATEST_TAG") | |
| (cd provider/shim && go get github.com/stackitcloud/terraform-provider-stackit@"$LATEST_TAG") | |
| make ensure | |
| make tfgen | |
| git add --all | |
| git commit -m "make tfgen" | |
| make generate_sdks | |
| git add --all | |
| git commit -m "make generate_sdks" | |
| git push --set-upstream origin "$BRANCH_NAME" | |
| gh pr create --title "Upgrade terraform-provider-stackit to $LATEST_TAG" --body "This PR was generated by the Pulumi upgrade CI pipeline" --base main --head "$BRANCH_NAME" |