From c4583ad3f0abc9d95cab4024439fc503cf9fabdc Mon Sep 17 00:00:00 2001
From: Baptiste Augrain <daiyam@zokugun.org>
Date: Thu, 16 Jun 2022 12:20:10 +0200
Subject: [PATCH] fix: use env variable instead of `login` option (#1128)

---
 .github/workflows/linux.yml       | 5 +++--
 stores/snapcraft/check_version.sh | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 34cff1e..0ce4a1e 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -116,7 +116,7 @@ jobs:
         run: ./stores/snapcraft/check_version.sh
         env:
           ARCHITECTURE: ${{ matrix.platform }}
-          SNAP_STORE_LOGIN: ${{ secrets.SNAP_STORE_LOGIN }}
+          SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
 
       # - uses: docker/setup-qemu-action@v1
       #   if: env.SHOULD_DEPLOY == 'yes'
@@ -142,7 +142,8 @@ jobs:
 
       - uses: snapcore/action-publish@v1
         with:
-          store_login: ${{ secrets.SNAP_STORE_LOGIN }}
           snap: ${{ steps.build.outputs.snap }}
           release: stable
+        env:
+          SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
         if: env.SHOULD_DEPLOY == 'yes'
diff --git a/stores/snapcraft/check_version.sh b/stores/snapcraft/check_version.sh
index 7965fc7..7e8326c 100755
--- a/stores/snapcraft/check_version.sh
+++ b/stores/snapcraft/check_version.sh
@@ -15,8 +15,6 @@ else
 
   sudo snap install --channel stable --classic snapcraft
 
-  echo "${SNAP_STORE_LOGIN}" | snapcraft login --with -
-
   echo "Architecture: ${ARCHITECTURE}"
 
   SNAP_VERSION=$(snapcraft list-revisions codium | grep -F "stable*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4)