Skip to content

Commit

Permalink
ci: create build pipeline for snapcraft (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
matifali authored Aug 6, 2024
1 parent fe8c684 commit 3a99766
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 6 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/publish-snaps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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 }}
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
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"
echo "release_channel=${{ github.event.client_payload.release_channel }}" >> "$GITHUB_OUTPUT"
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "coder_version=${{ github.event.inputs.coder_version }}" >> "$GITHUB_OUTPUT"
echo "release_channel=${{ github.event.inputs.release_channel }}" >> "$GITHUB_OUTPUT"
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
- name: Setup Snapcraft
uses: samuelmeuli/action-snapcraft@v2

- name: Build and publish snaps
run: |
snapcraft build
if [[ ${{ steps.metadata.outputs.release_channel }} == "stable" ]]; then
snapcraft upload --release=latest/stable *.snap
else
snapcraft upload --release=latest/candidate,latest/beta,latest/edge *.snap
fi
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.env
packer-manifest.json
# built snaps
*.snap
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,4 @@ Install [Coder](https://github.com/coder/coder) to your preferred cloud with a p
| <img src="./assets/render.png" alt="Render.com Logo" width="100" height="100" /> | Render | Live ✅ | [Docs: Deploy Coder on Render](./render/README.md) | [![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/coder/packages) |
| <img src="./assets/eks.svg" alt="AWS EKS Logo" width="100" height="100" /> | AWS EKS | In progress | [Docs: Coder on Kubernetes](https://coder.com/docs/v2/latest/install/kubernetes) | [Deploy from AWS Marketplace](https://example.com) |
| <img src="./assets/gce.svg" alt="Google Compute Engine logo" width="100" height="100" /> | Google Compute Engine | Live ✅ | [Guide: Google Compute Engine](https://coder.com/docs/v2/latest/platforms/gcp) | [Deploy from GCP Marketplace](https://console.cloud.google.com/marketplace/product/coder-enterprise-market-public/coder-v2) |
| <img src="./assets/snapcraft.svg" alt="Snapcraft Logo" width="100" height="100" /> | Snapcraft | Live ✅ | [Install Coder from Snapcraft](https://snapcraft.io/coder) |

[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-white.svg)](https://snapcraft.io/coder)
|
| <img src="./assets/snapcraft.svg" alt="Snapcraft Logo" width="100" height="100" /> | Snapcraft | Live ✅ | `snap install coder` | [![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-white.svg)](https://snapcraft.io/coder) |
4 changes: 2 additions & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: coder
title: Coder
type: app
base: core24
version: '2.12.4'
summary: Self-Hosted Cloud Development Environments
version: "2.13.1" # version is managed in .github/workflows/publish-snaps.yaml
summary: Self-Hosted Cloud Development Environments
license: AGPL-3.0
contact: https://coder.com/contact
issues: https://github.com/coder/coder/issues
Expand Down

0 comments on commit 3a99766

Please sign in to comment.