github.com/argoproj/argo-cd/v3@v3.2.1/.github/workflows/bump-major-version.yaml (about)

     1  name: Bump major version
     2  on:
     3    workflow_dispatch: {}
     4  
     5  permissions: {}
     6  
     7  jobs:
     8    prepare-release:
     9      permissions:
    10        contents: write  # for peter-evans/create-pull-request to create branch
    11        pull-requests: write  # for peter-evans/create-pull-request to create a PR
    12      name: Automatically update major version
    13      runs-on: ubuntu-22.04
    14      steps:
    15        - name: Checkout code
    16          uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694  # v4.0.0
    17          with:
    18            fetch-depth: 0
    19            token: ${{ secrets.GITHUB_TOKEN }}
    20  
    21        # Get the current major version from go.mod and save it as a variable.
    22        - name: Get target version
    23          id: get-target-version
    24          run: |
    25            set -ue
    26            CURRENT_VERSION=$(grep 'module github.com/argoproj/argo-cd' go.mod | awk '{print $2}' | sed 's/.*\/v//')
    27            echo "TARGET_VERSION=$((CURRENT_VERSION + 1))" >> $GITHUB_OUTPUT
    28  
    29        - name: Copy source code to GOPATH
    30          run: |
    31            mkdir -p ~/go/src/github.com/argoproj
    32            cp -a ../argo-cd ~/go/src/github.com/argoproj
    33  
    34        - name: Run script to bump the version
    35          run: |
    36            hack/bump-major-version.sh
    37          working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
    38  
    39        - name: Setup Golang
    40          uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
    41          with:
    42            go-version: ${{ env.GOLANG_VERSION }}
    43        - name: Add ~/go/bin to PATH
    44          run: |
    45            echo "/home/runner/go/bin" >> $GITHUB_PATH
    46        - name: Add /usr/local/bin to PATH
    47          run: |
    48            echo "/usr/local/bin" >> $GITHUB_PATH
    49        - name: Download & vendor dependencies
    50          run: |
    51            # We need to vendor go modules for codegen yet
    52            go mod download
    53            go mod vendor -v
    54          working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
    55        - name: Install toolchain for codegen
    56          run: |
    57            make install-codegen-tools-local
    58            make install-go-tools-local
    59          working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
    60          # We install kustomize in the dist directory
    61        - name: Add dist to PATH
    62          run: |
    63            echo "/home/runner/work/argo-cd/argo-cd/dist" >> $GITHUB_PATH
    64        - name: Run codegen
    65          run: |
    66            set -x
    67            export GOPATH=$(go env GOPATH)
    68            make codegen-local
    69          working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
    70  
    71        - name: Copy changes back
    72          run: |
    73            # Copy the contents back, but skip the .git directory
    74            rsync -a --exclude=.git /home/runner/go/src/github.com/argoproj/argo-cd/ ../argo-cd
    75  
    76        - name: Create pull request
    77          uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e  # v7.0.8
    78          with:
    79            commit-message: "Bump major version to ${{ steps.get-target-version.outputs.TARGET_VERSION }}"
    80            title: "Bump major version to ${{ steps.get-target-version.outputs.TARGET_VERSION }}"
    81            body: |
    82              Congrats! You've just bumped the major version to ${{ steps.get-target-version.outputs.TARGET_VERSION }}.
    83              
    84              Next steps:
    85              - [ ] Merge this PR
    86              - [ ] Add an upgrade guide to the docs for this version
    87            branch: bump-major-version
    88            branch-suffix: random
    89            signoff: true