Skip to content
Snippets Groups Projects
versions.yaml 2.67 KiB
name: Upgrade to latest versions

on:
  workflow_dispatch:
  schedule:
    - cron: '37 7 * * 1'
jobs:
  versions:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        branch:
          - 'release-0.7'
          - 'release-0.8'
          - 'release-0.9'
          - 'release-0.10'
          - 'main'
    steps:
    - uses: actions/checkout@v3
      with:
        ref: ${{ matrix.branch }}
    - uses: actions/setup-go@v2
      with:
        go-version: 1.16
    - name: Upgrade versions
      id: versions
      run: |
        export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
        # Write to temporary file to make update atomic
        scripts/generate-versions.sh > /tmp/versions.json
        mv /tmp/versions.json jsonnet/kube-prometheus/versions.json
        # Get the links to the changelogs of the updated versions and make them
        # available to the reviewers
        echo ::set-output name=new_changelogs::$(scripts/get-new-changelogs.sh)
      if: matrix.branch == 'main'
    - name: Update jsonnet dependencies
      run: |
        make update
        make generate

        # Reset jsonnetfile.lock.json if no dependencies were updated
        changedFiles=$(git diff --name-only | grep -v 'jsonnetfile.lock.json' | wc -l)
        if [[ "$changedFiles" -eq 0 ]]; then
          git checkout -- jsonnetfile.lock.json;
        fi
    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v4
      with:
        commit-message: "[bot] [${{ matrix.branch }}] Automated version update"
        title: "[bot] [${{ matrix.branch }}] Automated version update"
        body: |
          ## Description

          This is an automated version and jsonnet dependencies update performed from CI.

          Please review the following changelogs to make sure that we don't miss any important
          changes before merging this PR.

          ${{ steps.versions.outputs.new_changelogs }}

          Configuration of the workflow is located in `.github/workflows/versions.yaml`.

          ## Type of change

          - [x] `NONE` (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

          ## Changelog entry
          
          ```release-note