From 851b5f265975f9ab4d71fb158fd66cff767ef575 Mon Sep 17 00:00:00 2001
From: Baptiste Augrain <daiyam@zokugun.org>
Date: Sat, 18 Dec 2021 03:28:34 +0100
Subject: [PATCH] fix: pass platform and correctly release (#952)

---
 .github/workflows/linux.yml       | 11 ++++++-----
 stores/snapcraft/check_version.sh |  1 -
 stores/snapcraft/release.sh       | 11 +++++++++++
 3 files changed, 17 insertions(+), 6 deletions(-)
 create mode 100755 stores/snapcraft/release.sh

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 3f39d43..faa5e18 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -103,6 +103,7 @@ jobs:
     needs: release
     runs-on: ubuntu-latest
     strategy:
+      fail-fast: false
       matrix:
         platform:
         - amd64
@@ -114,6 +115,7 @@ jobs:
       - name: Check version
         run: ./stores/snapcraft/check_version.sh
         env:
+          ARCHITECTURE: ${{ matrix.platform }}
           SNAP_STORE_LOGIN: ${{ secrets.SNAP_STORE_LOGIN }}
 
       - uses: docker/setup-qemu-action@v1
@@ -126,9 +128,8 @@ jobs:
         id: build
         if: env.SHOULD_DEPLOY == 'yes'
 
-      - uses: snapcore/action-publish@v1
-        with:
-          store_login: ${{ secrets.SNAP_STORE_LOGIN }}
-          snap: ${{ steps.build.outputs.snap }}
-          release: stable
+      - name: Release snap
+        run: ./stores/snapcraft/release.sh
+        env:
+          SNAP_STORE_LOGIN: ${{ secrets.SNAP_STORE_LOGIN }}
         if: env.SHOULD_DEPLOY == 'yes'
diff --git a/stores/snapcraft/check_version.sh b/stores/snapcraft/check_version.sh
index 9375f8c..a34a12d 100755
--- a/stores/snapcraft/check_version.sh
+++ b/stores/snapcraft/check_version.sh
@@ -17,7 +17,6 @@ else
 
   echo "$SNAP_STORE_LOGIN" | snapcraft login --with -
 
-  ARCHITECTURE=$(dpkg --print-architecture)
   echo "Architecture: ${ARCHITECTURE}"
 
   SNAP_VERSION=$(snapcraft list-revisions codium | grep -F stable* | grep ${ARCHITECTURE} | tr -s ' ' | cut -d ' ' -f 4)
diff --git a/stores/snapcraft/release.sh b/stores/snapcraft/release.sh
new file mode 100755
index 0000000..6402b0c
--- /dev/null
+++ b/stores/snapcraft/release.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+CALLER_DIR=$( pwd )
+
+cd "$( dirname "${BASH_SOURCE[0]}" )"
+
+snapcraft upload --release=stable *.snap
+
+cd "${CALLER_DIR}"