Add develop and nightly builds

Ayman Bagabas created

Change summary

.github/workflows/build.yml              | 127 +++++++++++++++++++++++++
.github/workflows/goreleaser-publish.yml |  60 ------------
.github/workflows/goreleaser.yml         |  28 +++++
.goreleaser.yml                          |   2 
README.md                                |   1 
docker.md                                |   3 
6 files changed, 155 insertions(+), 66 deletions(-)

Detailed changes

.github/workflows/build.yml 🔗

@@ -1,7 +1,12 @@
 name: build
+
 on: [push, pull_request]
+
+permissions:
+  packages: write
+
 jobs:
-  test:
+  build:
     strategy:
       matrix:
         go-version: [~1.17, ^1]
@@ -25,4 +30,122 @@ jobs:
         run: go build -v ./...
 
       - name: Test
-        run: go test ./...
+        run: go test ./...
+
+  nightly:
+    env:
+      GO111MODULE: "on"
+      DOCKER_CLI_EXPERIMENTAL: enabled
+    runs-on: ubuntu-latest
+    steps:
+      - name: Install Go
+        uses: actions/setup-go@v2
+        with:
+          go-version: "~1.17"
+
+      - name: Checkout code
+        uses: actions/checkout@v2
+
+      - name: Login to GitHub Container Registry
+        uses: docker/login-action@v1
+        with:
+          registry: ghcr.io
+          username: ${{ github.repository_owner }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v1
+
+      - name: Set up Docker Buildx
+        id: buildx
+        uses: docker/setup-buildx-action@v1
+
+      - name: Run GoReleaser
+        uses: goreleaser/goreleaser-action@v2
+        with:
+          distribution: goreleaser
+          version: latest
+          args: release --snapshot --rm-dist --skip-sign
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
+
+      - name: Push docker images
+        run: |
+          GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
+
+          docker tag ghcr.io/$GITHUB_REPOSITORY:latest-amd64 ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-amd64
+          docker tag ghcr.io/$GITHUB_REPOSITORY:latest-arm64 ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-arm64
+          docker tag ghcr.io/$GITHUB_REPOSITORY:latest-armv7 ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-armv7
+          docker tag ghcr.io/$GITHUB_REPOSITORY:latest-i386 ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-i386
+
+          docker push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-amd64
+          docker push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-arm64
+          docker push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-armv7
+          docker push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-i386
+
+          docker manifest create ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH \
+            ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-amd64 \
+            ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-arm64 \
+            ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-armv7 \
+            ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH-i386
+          docker manifest push ghcr.io/$GITHUB_REPOSITORY:devel-$GIT_HASH
+
+          if [[ $GITHUB_REF = 'refs/heads/main' && $GITHUB_EVENT_NAME = 'push' ]]; then
+            docker tag ghcr.io/$GITHUB_REPOSITORY:latest-amd64 ghcr.io/$GITHUB_REPOSITORY:devel-amd64
+            docker tag ghcr.io/$GITHUB_REPOSITORY:latest-arm64 ghcr.io/$GITHUB_REPOSITORY:devel-arm64
+            docker tag ghcr.io/$GITHUB_REPOSITORY:latest-armv7 ghcr.io/$GITHUB_REPOSITORY:devel-armv7
+            docker tag ghcr.io/$GITHUB_REPOSITORY:latest-i386 ghcr.io/$GITHUB_REPOSITORY:devel-i386
+
+            docker push ghcr.io/$GITHUB_REPOSITORY:devel-amd64
+            docker push ghcr.io/$GITHUB_REPOSITORY:devel-arm64
+            docker push ghcr.io/$GITHUB_REPOSITORY:devel-armv7
+            docker push ghcr.io/$GITHUB_REPOSITORY:devel-i386
+
+            docker manifest create ghcr.io/$GITHUB_REPOSITORY:devel \
+              ghcr.io/$GITHUB_REPOSITORY:devel-amd64 \
+              ghcr.io/$GITHUB_REPOSITORY:devel-arm64 \
+              ghcr.io/$GITHUB_REPOSITORY:devel-armv7 \
+              ghcr.io/$GITHUB_REPOSITORY:devel-i386
+            docker manifest push ghcr.io/$GITHUB_REPOSITORY:devel
+          fi
+
+      - uses: actions/upload-artifact@v2
+        with:
+          name: Linux (x86_64)
+          path: |
+            dist/soft-serve_linux_amd64/*
+            LICENSE
+            README.md
+
+      - uses: actions/upload-artifact@v2
+        with:
+          name: Linux (arm64)
+          path: |
+            dist/soft-serve_linux_arm64/*
+            LICENSE
+            README.md
+
+      - uses: actions/upload-artifact@v2
+        with:
+          name: MacOS (x86_64)
+          path: |
+            dist/soft-serve_darwin_amd64/*
+            LICENSE
+            README.md
+
+      - uses: actions/upload-artifact@v2
+        with:
+          name: MacOS (arm64)
+          path: |
+            dist/soft-serve_darwin_arm64/*
+            LICENSE
+            README.md
+
+      - uses: actions/upload-artifact@v2
+        with:
+          name: Windows (x86_64)
+          path: |
+            dist/soft-serve_windows_amd64/*
+            LICENSE
+            README.md

.github/workflows/goreleaser-publish.yml 🔗

@@ -1,60 +0,0 @@
-name: goreleaser-publish
-
-on:
-  push:
-    tags:
-      - v*.*.*
-
-concurrency:
-  group: goreleaser
-  cancel-in-progress: true
-
-permissions:
-  contents: write
-  packages: write
-
-jobs:
-  goreleaser:
-    runs-on: ubuntu-latest
-    env:
-      DOCKER_CLI_EXPERIMENTAL: enabled
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v2
-        with:
-          fetch-depth: 0
-
-      - name: Set up Go
-        uses: actions/setup-go@v2
-        with:
-          go-version: 1.17
-
-      - name: Login to DockerHub
-        uses: docker/login-action@v1
-        with:
-          username: ${{ secrets.DOCKERHUB_USERNAME }}
-          password: ${{ secrets.DOCKERHUB_TOKEN }}
-
-      - name: Login to GitHub Container Registry
-        uses: docker/login-action@v1
-        with:
-          registry: ghcr.io
-          username: ${{ github.repository_owner }}
-          password: ${{ secrets.GITHUB_TOKEN }}
-
-      - name: Set up QEMU
-        uses: docker/setup-qemu-action@v1
-
-      - name: Set up Docker Buildx
-        id: buildx
-        uses: docker/setup-buildx-action@v1
-
-      - name: Run GoReleaser
-        uses: goreleaser/goreleaser-action@v2
-        with:
-          distribution: goreleaser
-          version: latest
-          args: release --rm-dist --skip-sign
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

.github/workflows/goreleaser.yml 🔗

@@ -1,6 +1,17 @@
 name: goreleaser
 
-on: [push, pull_request]
+on:
+  push:
+    tags:
+      - v*.*.*
+
+concurrency:
+  group: goreleaser
+  cancel-in-progress: true
+
+permissions:
+  contents: write
+  packages: write
 
 jobs:
   goreleaser:
@@ -18,6 +29,19 @@ jobs:
         with:
           go-version: 1.17
 
+      - name: Login to DockerHub
+        uses: docker/login-action@v1
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+      - name: Login to GitHub Container Registry
+        uses: docker/login-action@v1
+        with:
+          registry: ghcr.io
+          username: ${{ github.repository_owner }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
       - name: Set up QEMU
         uses: docker/setup-qemu-action@v1
 
@@ -30,7 +54,7 @@ jobs:
         with:
           distribution: goreleaser
           version: latest
-          args: release --snapshot --rm-dist --skip-sign
+          args: release --rm-dist --skip-sign
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

.goreleaser.yml 🔗

@@ -76,7 +76,7 @@ signs:
 checksum:
   name_template: "checksums.txt"
 snapshot:
-  name_template: "{{ .Tag }}-next"
+  name_template: "{{ incpatch .Version }}-devel"
 changelog:
   sort: asc
   filters:

README.md 🔗

@@ -8,6 +8,7 @@ Soft Serve
     </picture><br>
     <a href="https://github.com/charmbracelet/soft-serve/releases"><img src="https://img.shields.io/github/release/charmbracelet/soft-serve.svg" alt="Latest Release"></a>
     <a href="https://github.com/charmbracelet/soft-serve/actions"><img src="https://github.com/charmbracelet/soft-serve/workflows/build/badge.svg" alt="Build Status"></a>
+    <a href="https://nightly.link/charmbracelet/soft-serve/workflows/build/main"><img src="https://shields.io/badge/-Nightly%20Builds-orange?logo=hackthebox&logoColor=fff&style=appveyor"/></a>
 </p>
 
 A tasty, self-hostable Git server for the command line. 🍦

docker.md 🔗

@@ -1,6 +1,6 @@
 # Running Soft-Serve with Docker
 
-The official Soft Serve Docker images are available at [charmcli/soft-serve][docker].
+The official Soft Serve Docker images are available at [charmcli/soft-serve][docker]. Development and nightly builds are available at [ghcr.io/charmbracelet/soft-serve][ghcr]
 
 ```sh
 docker pull charmcli/soft-serve:latest
@@ -36,6 +36,7 @@ services:
 ```
 
 [docker]: https://hub.docker.com/r/charmcli/soft-serve
+[ghcr]: https://github.com/charmbracelet/soft-serve/pkgs/container/soft-serve
 
 ***