podman

Форк
0
/
update-podmanio.yml 
121 строка · 4.7 Кб
1
name: Update Podman version on Podman.io
2

3
on:
4
  release:
5
    types: [published]
6
  workflow_dispatch:
7
    inputs:
8
      version:
9
        description: 'Release version to build and upload (e.g. "v9.8.7")'
10
        required: true
11

12
jobs:
13
  bump:
14
    name: Bump
15
    runs-on: ubuntu-22.04
16
    steps:
17
      - name: Get version
18
        id: getversion
19
        run: |
20

21
          if [[ -z "${{ inputs.version }}" ]]
22
          then
23
                VERSION=${{ github.event.release.tag_name }}
24
          else
25
                VERSION=${{ inputs.version }}
26
          fi
27

28
          # strip out the prefix v if it's there
29
          if [[ $VERSION == v* ]]; then
30
            VERSION="${VERSION:1}"
31
          fi
32
          echo "Bump to ${VERSION}"
33

34
          if [[ $VERSION != *-rc* ]] && [[ $VERSION != *-dev ]]; then
35
            echo "notRC=true" >> "$GITHUB_OUTPUT"
36
          else
37
            echo "SKIPPING: Version is a RC or a dev, no need to update."
38
          fi
39
          echo "version=$VERSION" >> "$GITHUB_OUTPUT"
40

41
      - name: Check open PRs
42
        if: steps.getversion.outputs.notRC == 'true'
43
        id: checkpr
44
        run: |
45
          prs=$(gh pr list \
46
            --repo containers/podman.io \
47
            --head bump-podmanv${{ steps.getversion.outputs.version }} \
48
            --state open \
49
            --json title \
50
            --jq 'length')
51
          if ((prs > 0)); then
52
            echo "SKIPPING: PR already exists to update to v${{ steps.getversion.outputs.version }}."
53
          else
54
            echo "prexists=false" >> "$GITHUB_OUTPUT"
55
          fi
56
        env:
57
          GH_TOKEN: ${{ secrets.PODMANBOT_TOKEN }}
58

59
      - uses: actions/checkout@v4
60
        if: >-
61
            steps.getversion.outputs.notRC == 'true' &&
62
            steps.checkpr.outputs.prexists == 'false'
63
        with:
64
          repository: containers/podman.io
65
          ref: refs/heads/main
66
          token: ${{ secrets.PODMANBOT_TOKEN }}
67

68
      - name: Check version
69
        if: >-
70
            steps.getversion.outputs.notRC == 'true' &&
71
            steps.checkpr.outputs.prexists == 'false'
72
        id: checkversion
73
        run: |
74
          # Check if version is actually higher than one on podman.io
75
          prevversion=`grep -P "(?<=export const LATEST_VERSION = ')(\d.\d.\d)" -o static/data/global.ts`
76
          echo "Version currently on site: ${prevversion}"
77
          echo "Version to update to: ${{ steps.getversion.outputs.version }}"
78
          # sort -V -C returns 0 if args are ascending version order
79
          if echo "${prevversion},${{ steps.getversion.outputs.version }}" | tr ',' '\n' | sort -V -C && [[ ${prevversion} != ${{ steps.getversion.outputs.version }} ]]
80
          then
81
            echo "needsUpdate=true" >> $GITHUB_OUTPUT
82
            echo "This release is a higher version, so we need to update podman.io"
83
          else
84
            echo "SKIPPING: This release is not a higher version, no need to update."
85
          fi
86

87
      - name: Bump version
88
        if: >-
89
          steps.getversion.outputs.notRC == 'true' &&
90
          steps.checkversion.outputs.needsUpdate == 'true' &&
91
          steps.checkpr.outputs.prexists == 'false'
92
        run: |
93
          # Replace the version in static/data/global.ts file
94
          sed -i "s/export const LATEST_VERSION = '.*';/export const LATEST_VERSION = '${{ steps.getversion.outputs.version }}';/g" static/data/global.ts
95
          echo "Updated file:"
96
          cat static/data/global.ts
97

98
      - name: Open PR
99
        if: >-
100
            steps.getversion.outputs.notRC == 'true' &&
101
            steps.checkversion.outputs.needsUpdate == 'true' &&
102
            steps.checkpr.outputs.prexists == 'false'
103
        run: |
104
          # Make commiter the user who triggered the action, either through cutting a release or manual trigger
105
          # GitHub gives everyone a noreply email associated with their account, use that email for the sign-off
106
          git config --local user.name ${{ github.actor }}
107
          git config --local user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
108
          bumpbranch="bump-podmanv${{ steps.getversion.outputs.version }}"
109
          git checkout -b $bumpbranch
110
          git add static/data/global.ts
111
          git commit --signoff -m "Bump Podman to v${{ steps.getversion.outputs.version }}"
112
          git remote -v
113
          git remote add podmanbot https://github.com/podmanbot/podman.io
114
          git push podmanbot "+$bumpbranch"
115
          gh pr create \
116
            --title "Bump Podman to v${{ steps.getversion.outputs.version }}" \
117
            --body  "Bump Podman to v${{ steps.getversion.outputs.version }}" \
118
            --head "podmanbot:$bumpbranch" \
119
            --base "main" -R "containers/podman.io"
120
        env:
121
          GH_TOKEN: ${{ secrets.PODMANBOT_TOKEN }}
122

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.