From cc8e5986e7c35852782f7513272b9827182c5777 Mon Sep 17 00:00:00 2001
From: Will McCutchen <will@mccutch.org>
Date: Mon, 17 Oct 2022 18:51:26 -0400
Subject: [PATCH] Add workflow to push docker images for new releases (#87)

---
 .github/workflows/release.yaml | 54 ++++++++++++++++++++++++++++++++++
 1 file changed, 54 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..1517dd9
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,54 @@
+# This action pushes new amd64 and arm64 docker images to the Docker and GitHub
+# registries on every new release of the project.
+#
+# Cobbled together from these sources:
+# - https://github.com/docker/build-push-action/#usage
+# - https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
+
+name: Release
+
+"on":
+  release:
+    types: [published]
+
+jobs:
+  docker:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out the repo
+        uses: actions/checkout@v3
+
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v2
+
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
+
+      - name: Login to Docker Hub
+        uses: docker/login-action@v2
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+      - name: Login to GitHub Container Registry
+        uses: docker/login-action@v2
+        with:
+          registry: ghcr.io
+          username: mccutchen
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Extract metadata for Docker
+        id: meta
+        uses: docker/metadata-action@v4
+        with:
+          images: |
+            mccutchen/go-httpbin
+            ghrc.io/mccutchen/go-httpbin
+
+      - name: Build and push
+        uses: docker/build-push-action@v3
+        with:
+          platforms: linux/amd64,linux/arm64
+          push: true
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
-- 
GitLab