From e4543083104af0299679ada70de3fecec2b42bfd Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Thu, 14 Sep 2023 07:24:15 +0000 Subject: [PATCH] build: release snap Signed-off-by: Billy Zha --- .github/workflows/release-snap.yml | 55 +++++++++++++++++++ snapcraft.yaml => .github/workflows/snapcraft | 4 +- 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release-snap.yml rename snapcraft.yaml => .github/workflows/snapcraft (97%) diff --git a/.github/workflows/release-snap.yml b/.github/workflows/release-snap.yml new file mode 100644 index 000000000..deb05697a --- /dev/null +++ b/.github/workflows/release-snap.yml @@ -0,0 +1,55 @@ +# Copyright The ORAS Authors. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: release-snap + +on: + push: + tags: + - v* + branches: + - snap + +jobs: + release-snap: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: extract version + id: version + run: | + VERSION=${GITHUB_REF#refs/*/} + BRANCH_NAME=${GITHUB_REF#refs/heads/} + if [[ "${VERSION}" == "${BRANCH_NAME}" ]]; then + VERSION=$(git rev-parse --short HEAD) + fi + echo "version=${VERSION}" >> $GITHUB_OUTPUT + - name: make snapcraft + run: | + sed -i 's/{VERSION}/${{ steps.version.outputs.version }}/g' .github/workflows/snapcraft + cat ./.github/workflows/snapcraft + - uses: snapcore/action-build@v1 + id: build + with: + path: .github/workflows/snapcraft + - uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} + with: + snap: ${{ steps.build.outputs.snap }} + release: edge + diff --git a/snapcraft.yaml b/.github/workflows/snapcraft similarity index 97% rename from snapcraft.yaml rename to .github/workflows/snapcraft index 4a3f47b58..cafbce539 100644 --- a/snapcraft.yaml +++ b/.github/workflows/snapcraft @@ -12,12 +12,12 @@ # limitations under the License. name: oras -version: 'v1.0.0' +version: '{VERSION}' summary: Package for the ORAS CLI tool description: | A snap package for the ORAS CLI tool, which is used for managing OCI artifacts. base: core22 -confinement: strict +confinement: classic grade: stable architectures: