|
1 | | -env: |
2 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
3 | | -jobs: |
4 | | - upgrade_provider: |
5 | | - if: ${{ (contains(github.event.issue.title, 'Upgrade terraform-provider-')) || github.event_name == 'workflow_dispatch' }} |
6 | | - name: upgrade-provider |
7 | | - runs-on: ubuntu-latest |
8 | | - steps: |
9 | | - - name: Call upgrade provider action |
10 | | - uses: pulumi/pulumi-upgrade-provider-action@e247104aede3eb4641f48c8ad0ea9de9346f2457 # v0.0.18 |
11 | | - with: |
12 | | - kind: all |
13 | 1 | name: Upgrade provider |
14 | 2 |
|
15 | 3 | permissions: |
|
21 | 9 | types: |
22 | 10 | - opened |
23 | 11 | workflow_dispatch: {} |
| 12 | + |
| 13 | +env: |
| 14 | + GH_TOKEN: ${{ secrets.PR_TOKEN }} |
| 15 | + GO_VERSION: "1.24" |
| 16 | + |
| 17 | +jobs: |
| 18 | + upgrade_provider: |
| 19 | + if: ${{ (contains(github.event.issue.title, 'Upgrade terraform-provider-')) || github.event_name == 'workflow_dispatch' }} |
| 20 | + name: upgrade-provider |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v6 |
| 25 | + # TODO: remove when this repo is made public |
| 26 | + - name: Configure Git for Private Modules |
| 27 | + run: | |
| 28 | + git config --global url."https://oauth2:${{ secrets.PR_TOKEN }}@github.com".insteadOf "https://github.com" |
| 29 | + # Sets GOPRIVATE and GONOSUMDB in order to use the git authetnication for go mod. |
| 30 | + echo "GOPRIVATE=github.com/${{ github.repository }}/*,github.com/stackitcloud/*" >> $GITHUB_ENV |
| 31 | + echo "GONOSUMDB=github.com/${{ github.repository }}/*,github.com/stackitcloud/*" >> $GITHUB_ENV |
| 32 | + # TODO: remove end |
| 33 | + - name: Unshallow clone for tags |
| 34 | + run: git fetch --prune --unshallow --tags |
| 35 | + - name: Install Go Tools |
| 36 | + uses: ./.github/actions/gotools |
| 37 | + with: |
| 38 | + go-version: ${{ env.GO_VERSION }} |
| 39 | + - name: Install Pulumi Tools |
| 40 | + uses: ./.github/actions/pulumitools |
| 41 | + - name: Get latest tag from terraform-provider-stackit and update the pulumi provider and bridge |
| 42 | + run: | |
| 43 | + git config user.name "Pulumi Generator Bot" |
| 44 | + git config user.email "[email protected]" |
| 45 | + 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) |
| 46 | + BRANCH_NAME="upgrade-terraform-provider-stackit-to-$LATEST_TAG" |
| 47 | + git checkout -b "$BRANCH_NAME" |
| 48 | + (cd provider && go get github.com/stackitcloud/terraform-provider-stackit@"$LATEST_TAG") |
| 49 | + (cd provider/shim && go get github.com/stackitcloud/terraform-provider-stackit@"$LATEST_TAG") |
| 50 | + make ensure |
| 51 | + make tfgen |
| 52 | + git add --all |
| 53 | + git commit -m "make tfgen" |
| 54 | + make generate_sdks |
| 55 | + git add --all |
| 56 | + git commit -m "make generate_sdks" |
| 57 | + git push --set-upstream origin "$BRANCH_NAME" |
| 58 | + 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" |
0 commit comments