podman

Форк
0
/
release-artifacts.yml 
179 строк · 6.0 Кб
1
name: Upload Release Artifacts
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
      dryrun:
12
        description: 'Perform all the steps except uploading to the release page'
13
        required: true
14
        default: "true"  # 'choice' type requires string value
15
        type: choice
16
        options:
17
          - "true"  # Must be quoted string, boolean value not supported.
18
          - "false"
19

20
permissions:
21
  contents: write
22

23
jobs:
24
  build:
25
    runs-on: ubuntu-22.04
26
    steps:
27
    - name: Determine Version
28
      id: getversion
29
      run: |
30
        if [[ -z "${{ inputs.version }}" ]]
31
        then
32
              VERSION=${{ github.event.release.tag_name }}
33
        else
34
              VERSION=${{ inputs.version }}
35
        fi
36
        echo
37
        echo "version=$VERSION" >> $GITHUB_OUTPUT
38

39
    - name: Consolidate dryrun setting to always be true or false
40
      id: actual_dryrun
41
      run: |
42
        # The 'release' trigger will not have a 'dryrun' input set. Handle
43
        # this case in a readable/maintainable way.
44
        if [[ -z "${{ inputs.dryrun }}" ]]
45
        then
46
          echo "dryrun=false" >> $GITHUB_OUTPUT
47
        else
48
          echo "dryrun=${{ inputs.dryrun }}" >> $GITHUB_OUTPUT
49
        fi
50

51
    - name: Check uploads
52
      id: check
53
      run: |
54
          URI="https://github.com/containers/podman/releases/download/${{steps.getversion.outputs.version}}"
55
          for artifact in "podman-remote-release-darwin_amd64.zip darwin_amd" \
56
                'podman-remote-release-darwin_arm64.zip darwin_arm' \
57
                'podman-remote-release-windows_amd64.zip windows_amd' \
58
                'podman-remote-static-linux_amd64.tar.gz linux_amd' \
59
                'podman-remote-static-linux_arm64.tar.gz linux_arm'
60
          do
61
            set -- $artifact # Convert the "tuple" into the param args $1 $2...
62
            status=$(curl -s -o /dev/null -w "%{http_code}" "${URI}/${1:?}")
63
            if [[ "$status" == "404" ]] ; then
64
              needsbuild=true
65
              echo "${2:?}=true"
66
            else
67
              echo "::warning::${artifact} already exists, skipping"
68
            fi
69
          done
70

71
          if [ "$needsbuild" = true ]; then
72
            echo "buildartifacts=true" >> $GITHUB_OUTPUT
73
          else
74
            echo "No new artifacts need to be built."
75
          fi
76

77
    - name: Checkout Version
78
      if: >-
79
        steps.check.outputs.buildartifacts == 'true' ||
80
        steps.actual_dryrun.outputs.dryrun == 'true'
81
      uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
82
      with:
83
        repository: containers/podman
84
        ref: ${{steps.getversion.outputs.version}}
85

86
    - name: Set up Go
87
      if: >-
88
        steps.check.outputs.buildartifacts == 'true' ||
89
        steps.actual_dryrun.outputs.dryrun == 'true'
90
      uses: actions/setup-go@v5
91
      with:
92
        go-version: stable
93

94
    - name: Setup artifact directory
95
      if: >-
96
        steps.check.outputs.buildartifacts == 'true' ||
97
        steps.actual_dryrun.outputs.dryrun == 'true'
98
      run: mkdir -p release/
99

100
    - name: Build Darwin AMD
101
      if: >-
102
        steps.check.outputs.darwin_amd == 'true' ||
103
        steps.actual_dryrun.outputs.dryrun == 'true'
104
      run: |
105
          make podman-remote-release-darwin_amd64.zip
106
          mv podman-remote-release-darwin_amd64.zip release/
107

108
    - name: Build Darwin ARM
109
      if: >-
110
        steps.check.outputs.darwin_arm  == 'true' ||
111
        steps.actual_dryrun.outputs.dryrun == 'true'
112
      run: |
113
          make podman-remote-release-darwin_arm64.zip
114
          mv podman-remote-release-darwin_arm64.zip release/
115

116
    - name: Build Linux AMD
117
      if: >-
118
        steps.check.outputs.linux_amd == 'true' ||
119
        steps.actual_dryrun.outputs.dryrun == 'true'
120
      run: |
121
            make podman-remote-static-linux_amd64
122
            tar -cvzf podman-remote-static-linux_amd64.tar.gz bin/podman-remote-static-linux_amd64
123
            mv podman-remote-static-linux_amd64.tar.gz release/
124

125
    - name: Build Linux ARM
126
      if: >-
127
        steps.check.outputs.linux_arm == 'true' ||
128
        steps.actual_dryrun.outputs.dryrun == 'true'
129
      run: |
130
          make podman-remote-static-linux_arm64
131
          tar -cvzf podman-remote-static-linux_arm64.tar.gz bin/podman-remote-static-linux_arm64
132
          mv podman-remote-static-linux_arm64.tar.gz release/
133

134
    - name: Build Windows AMD
135
      if: >-
136
        steps.check.outputs.windows_amd == 'true' ||
137
        steps.actual_dryrun.outputs.dryrun == 'true'
138
      run: |
139
          sudo apt-get install -y pandoc
140
          make podman-remote-release-windows_amd64.zip
141
          mv podman-remote-release-windows_amd64.zip release/
142

143
    - name: shasums
144
      if: >-
145
        steps.check.outputs.buildartifacts == 'true' ||
146
        steps.actual_dryrun.outputs.dryrun == 'true'
147
      run: |
148
          pushd release
149
          sha256sum *.zip *.tar.gz > shasums
150
          popd
151

152
    - name: Upload to Actions as artifact
153
      if: >-
154
        steps.check.outputs.buildartifacts == 'true' ||
155
        steps.actual_dryrun.outputs.dryrun == 'true'
156
      uses: actions/upload-artifact@v4
157
      with:
158
        name: artifacts
159
        path: |
160
          release/*
161

162
    - name: Upload to Release
163
      if: >-
164
        steps.check.outputs.buildartifacts == 'true' &&
165
        steps.actual_dryrun.outputs.dryrun == 'false'
166
      env:
167
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168
      run: |
169
        (gh release download ${{steps.getversion.outputs.version}} -p "shasums" || exit 0)
170
        cat release/shasums >> shasums
171
        gh release upload ${{steps.getversion.outputs.version}} release/*.zip release/*.tar.gz
172
        gh release upload ${{steps.getversion.outputs.version}} --clobber shasums
173

174
    - name: Trigger Windows Installer
175
      if: >-
176
          steps.check.outputs.windows_amd == 'true' ||
177
          steps.actual_dryrun.outputs.dryrun == 'false'
178
      run: |
179
        gh workflow run upload-win-installer.yml -f ${{steps.getversion.outputs.version}} -f dryrun=false
180

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

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

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

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