github.com/goharbor/go-client@v0.210.0/.github/workflows/prepare-new-version.yml (about)

     1  name: Prepare new Release
     2  run-name: ${{ github.actor }} is preparing a new Release 🚀
     3  on:
     4    workflow_dispatch:
     5      inputs:
     6        version:
     7          description: Define Harbor Version
     8  
     9  jobs:
    10    prepare_new_release:
    11      runs-on: ubuntu-latest
    12      permissions:
    13        contents: write
    14        pull-requests: write
    15      steps:
    16        - uses: actions/checkout@v4
    17        - name: Prepare Repository
    18          run: |
    19            git fetch
    20            git switch release-version-${{ github.event.inputs.version }} || git switch -c release-version-${{ github.event.inputs.version }}
    21            git config user.name ${{ github.actor }}
    22            git config user.email '${{ github.actor }}@users.noreply.github.com'
    23        - name: Update Version
    24          run: |
    25            sed -E "s/v[0-9]+\.[0-9]+\.[0-9]+/v${{ github.event.inputs.version }}/g" -i README.md
    26            sed -E "s/(VERSION := )v[0-9]+\.[0-9]+\.[0-9]+/\1v${{ github.event.inputs.version }}/g" -i Makefile
    27            make gen-harbor-api
    28        - name: Commit and Push Changes
    29          run: |
    30            git add -A
    31            git commit --signoff -m "Release Version ${{ github.event.inputs.version }}" || echo "Nothing to commit"
    32            git push origin release-version-${{ github.event.inputs.version }}
    33        - name: Create Pull Request
    34          run: |
    35            if gh pr view release-version-${{ github.event.inputs.version }}; then
    36              echo "Pull request release-version-${{ github.event.inputs.version }} already exists"
    37              exit 0
    38            else
    39              echo "Creating Pull request release-version-${{ github.event.inputs.version }}"
    40              gh pr create -B main -H release-version-${{ github.event.inputs.version }} --title 'Release Version ${{ github.event.inputs.version }}' --body 'Created by Github action'
    41            fi
    42          env:
    43            GITHUB_TOKEN: ${{ github.token }}