|
| 1 | +# Copyright The ORAS Authors. |
| 2 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | +# you may not use this file except in compliance with the License. |
| 4 | +# You may obtain a copy of the License at |
| 5 | +# |
| 6 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +# |
| 8 | +# Unless required by applicable law or agreed to in writing, software |
| 9 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +# See the License for the specific language governing permissions and |
| 12 | +# limitations under the License. |
| 13 | + |
| 14 | +name: release-snap |
| 15 | + |
| 16 | +on: |
| 17 | + workflow_dispatch: |
| 18 | + inputs: |
| 19 | + version: |
| 20 | + description: 'release version, like v1.2.0-beta.1' |
| 21 | + required: true |
| 22 | + isStable: |
| 23 | + type: boolean |
| 24 | + description: 'check for stable release' |
| 25 | + default: false |
| 26 | + |
| 27 | +jobs: |
| 28 | + release-snap: |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + arch: |
| 32 | + - 'amd64' |
| 33 | + - 'arm64' |
| 34 | + - 's390x' |
| 35 | + runs-on: ubuntu-latest |
| 36 | + permissions: |
| 37 | + contents: read |
| 38 | + steps: |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@v3 |
| 41 | + - name: extract version |
| 42 | + id: version |
| 43 | + run: | |
| 44 | + if [[ "${{ github.event.inputs.isStable }}" == "true" ]]; then |
| 45 | + echo "release=stable" >> $GITHUB_OUTPUT |
| 46 | + else |
| 47 | + echo "release=candidate" >> $GITHUB_OUTPUT |
| 48 | + fi |
| 49 | + echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT |
| 50 | + - name: make snapcraft |
| 51 | + run: | |
| 52 | + sed -i 's/{VERSION}/${{ steps.version.outputs.version }}/g' snapcraft.yaml |
| 53 | + sed -i 's/{ARCH}/${{ matrix.arch }}/g' snapcraft.yaml |
| 54 | + cat snapcraft.yaml |
| 55 | + - uses: snapcore/action-build@v1 |
| 56 | + id: build |
| 57 | + - uses: snapcore/action-publish@v1 |
| 58 | + name: publish |
| 59 | + env: |
| 60 | + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} |
| 61 | + with: |
| 62 | + snap: ${{ steps.build.outputs.snap }} |
| 63 | + release: ${{ steps.version.outputs.release }} |
| 64 | + |
0 commit comments