Skip to content

Commit

Permalink
build: release snap
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <[email protected]>
  • Loading branch information
qweeah committed Sep 14, 2023
1 parent 788b4fb commit e454308
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/release-snap.yml
Original file line number Diff line number Diff line change
@@ -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

4 changes: 2 additions & 2 deletions snapcraft.yaml → .github/workflows/snapcraft
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e454308

Please sign in to comment.