From bbbca9ddfc7dd583cab61626b3b2e1e3685bfbdf Mon Sep 17 00:00:00 2001
From: Sam Kim <sam@authzed.com>
Date: Fri, 29 Mar 2024 15:57:28 -0700
Subject: [PATCH] Add release workflow (#2)

---
 .github/workflows/release.yaml | 39 ++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 .github/workflows/release.yaml

diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 0000000..33467e6
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,39 @@
+---
+name: "Release"
+on:
+  push:
+    tags:
+      - "*"
+env:
+  REGISTRY: "ghcr.io"
+  IMAGE_NAME: "authzed/spicedb-playground"
+jobs:
+  build-and-push-image:
+    runs-on: "buildjet-4vcpu-ubuntu-2204"
+    permissions:
+      contents: "write"
+      packages: "write"
+    steps:
+      - uses: "actions/checkout@v4"
+        with:
+          fetch-depth: 0
+      - name: "Log in to container registry"
+        uses: "docker/login-action@v3.1.0"
+        with:
+          registry: ${{ env.REGISTRY }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      - name: "Extract metadata (tags, labels) for Docker"
+        id: meta
+        uses: "docker/metadata-action@v5.5.1"
+        with:
+          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+          tags: |
+            type=semver,pattern={{raw}}
+      - name: "Build and push Docker image"
+        uses: "docker/build-push-action@v5.3.0"
+        with:
+          context: .
+          push: true
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}