Skip to content

publish-snaps

publish-snaps #6

name: publish-snaps
on:
workflow_dispatch:
inputs:
coder_version:
description: "Coder version"
required: true
release_channel:
description: "Release channel"
required: true
type: choice
options:
- stable
- mainline
repository_dispatch:
types: [coder-release]
jobs:
build-and-publish:
runs-on: ${{ matrix.os }}
name: publish-snaps
strategy:
matrix:
os:
- depot-ubuntu-22.04
- depot-ubuntu-22.04-arm
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set metadata
id: metadata
run: |
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
echo "coder_version=${{ github.event.client_payload.coder_version }}" >> "$GITHUB_OUTPUT"
if [[ "${{ github.event.client_payload.release_channel }}" == "stable" ]]; then
echo "release_channel=stable" >> "$GITHUB_OUTPUT"
else
echo "release_channel=candidate" >> "$GITHUB_OUTPUT"
fi
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "coder_version=${{ github.event.inputs.coder_version }}" >> "$GITHUB_OUTPUT"
if [[ "${{ github.event.inputs.release_channel }}" == "stable" ]]; then
echo "release_channel=stable" >> "$GITHUB_OUTPUT"
else
echo "release_channel=candidate,beta,edge" >> "$GITHUB_OUTPUT"
fi
else
echo "Unknown event: ${{ github.event_name }}"
exit 1
fi
- name: Set version in snapcraft.yaml
run: |
sed -i "s/version: \".*\"/version: \"${{ steps.metadata.outputs.coder_version }}\"/" snap/snapcraft.yaml
git diff snap/snapcraft.yaml
- uses: snapcore/action-build@v1
id: build
- uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
with:
snap: ${{ steps.build.outputs.snap }}
release: ${{ steps.metadata.outputs.release_channel }}