Skip to content

use virtio bus for CDs #85

use virtio bus for CDs

use virtio bus for CDs #85

Workflow file for this run

name: Deploy
on:
push:
tags:
- v*
branches:
- main
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
TZ: Europe/Berlin
DOCKER_BUILDKIT: 1
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(git describe --tags)
PLACEHOLDER='__version__ = "unknown"'
VERSION_FILE='minivirt/version.py'
# ensure the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE"
grep "version: 'git'" snap/snapcraft.yaml
sed -i "s/version: 'git'/version: ${VERSION}/g" snap/snapcraft.yaml
- name: Deploy image
run: |
IMAGE_VERSION=$(git describe --tags)
docker build -t restvirt:${IMAGE_VERSION} .
docker tag restvirt:${IMAGE_VERSION} ghcr.io/verbit/restvirt:${IMAGE_VERSION}
docker push ghcr.io/verbit/restvirt:${IMAGE_VERSION}
- name: Build Snap
uses: snapcore/action-build@v1
id: snapcraft
- name: Determine Snap Channel
id: snap_channel
run: |
if (git describe --tags --exact-match); then
echo '::set-output name=SNAP_CHANNEL::stable'
else
echo '::set-output name=SNAP_CHANNEL::edge'
fi
- name: Deploy Snap
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_CREDS }}
with:
snap: ${{ steps.snapcraft.outputs.snap }}
release: ${{ steps.snap_channel.outputs.SNAP_CHANNEL }}