mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-28 19:44:21 +01:00
Setup the snapcraft environment manually as the action we had been using for this does not appear to be actively maintained currently. Related to this, switch to specifying the snapcraft store credentials using the `SNAPCRAFT_STORE_CREDENTIALS` secret. This unbreaks `snapcraft upload`, which Canonical appear to have broken by removing the previous facility. Fixes: #5772. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
53 lines
1.9 KiB
YAML
53 lines
1.9 KiB
YAML
name: Release Kata in snapcraft store
|
|
on:
|
|
push:
|
|
tags:
|
|
- '[0-9]+.[0-9]+.[0-9]+*'
|
|
|
|
env:
|
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.snapcraft_token }}
|
|
|
|
jobs:
|
|
release-snap:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Snapcraft
|
|
run: |
|
|
# Required to avoid snapcraft install failure
|
|
sudo chown root:root /
|
|
|
|
# "--classic" is needed for the GitHub action runner
|
|
# environment.
|
|
sudo snap install snapcraft --classic
|
|
|
|
# Allow other parts to access snap binaries
|
|
echo /snap/bin >> "$GITHUB_PATH"
|
|
|
|
- name: Build snap
|
|
run: |
|
|
# Removing man-db, workflow kept failing, fixes: #4480
|
|
sudo apt -y remove --purge man-db
|
|
sudo apt-get install -y git git-extras
|
|
kata_url="https://github.com/kata-containers/kata-containers"
|
|
latest_version=$(git ls-remote --tags ${kata_url} | egrep -o "refs.*" | egrep -v "\-alpha|\-rc|{}" | egrep -o "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+" | sort -V -r | head -1)
|
|
current_version="$(echo ${GITHUB_REF} | cut -d/ -f3)"
|
|
# Check semantic versioning format (x.y.z) and if the current tag is the latest tag
|
|
if echo "${current_version}" | grep -q "^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+$" && echo -e "$latest_version\n$current_version" | sort -C -V; then
|
|
# Current version is the latest version, build it
|
|
snapcraft snap --debug --destructive-mode
|
|
fi
|
|
|
|
- name: Upload snap
|
|
run: |
|
|
snap_version="$(echo ${GITHUB_REF} | cut -d/ -f3)"
|
|
snap_file="kata-containers_${snap_version}_amd64.snap"
|
|
# Upload the snap if it exists
|
|
if [ -f ${snap_file} ]; then
|
|
snapcraft upload --release=stable ${snap_file}
|
|
fi
|