fix: properly configure snap packaging with separate workflow #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish Snap | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Snapcraft | |
uses: samuelmeuli/action-snapcraft@v2 | |
with: | |
use_lxd: true | |
- name: Extract version from tag | |
id: get_version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "The version is $VERSION" | |
- name: Update version in snapcraft.yaml | |
run: | | |
sed -i "s/^version: git/version: $VERSION/" snap/snapcraft.yaml | |
cat snap/snapcraft.yaml | |
- name: Build snap | |
run: | | |
snapcraft | |
- name: Publish snap | |
uses: snapcore/action-publish@v1 | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} | |
with: | |
snap: httpprobe_*.snap | |
release: stable |