From 8f183e6101ba4e7a1bfd97887aff008886979d7c Mon Sep 17 00:00:00 2001
From: Matthew Penner <me@matthewp.io>
Date: Thu, 7 Jan 2021 16:51:37 -0700
Subject: [PATCH] Properly add the version to Docker builds

---
 .github/workflows/docker.yml | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index f5e4a4f2e..b8784cd82 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -1,30 +1,46 @@
 name: Publish Docker Image
+
 on:
   push:
     branches:
       - 'develop'
     tags:
       - 'v*'
+
 jobs:
   push_to_registry:
     name: Push Image to GitHub Packages
     runs-on: ubuntu-latest
+
     # Always run against a tag, even if the commit into the tag has [docker skip]
     # within the commit message.
     if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
+
     steps:
       - uses: actions/checkout@v2
+
       - uses: crazy-max/ghaction-docker-meta@v1
         id: docker_meta
         with:
           images: ghcr.io/pterodactyl/panel
+
       - uses: docker/setup-qemu-action@v1
+
       - uses: docker/setup-buildx-action@v1
+
       - uses: docker/login-action@v1
         with:
           registry: ghcr.io
           username: ${{ github.repository_owner }}
           password: ${{ secrets.REGISTRY_TOKEN }}
+
+      - name: Bump Version
+        if: "!contains(github.ref, 'develop')"
+        env:
+          REF: ${{ github.ref }}
+        run: |
+          sed -i "s/    'version' => 'canary',/    'version' => '${REF:11}',/" config/app.php
+
       - name: Release Production Build
         uses: docker/build-push-action@v2
         if: "!contains(github.ref, 'develop')"
@@ -32,6 +48,7 @@ jobs:
           push: true
           tags: ${{ steps.docker_meta.outputs.tags }}
           labels: ${{ steps.docker_meta.outputs.labels }}
+
       - name: Release Development Build
         uses: docker/build-push-action@v2
         if: "contains(github.ref, 'develop')"