From 80775993874789214b488f6d9997c5c614e2024d Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Tue, 24 Mar 2026 10:50:59 +0100 Subject: [PATCH] build(snap): add auth check --- .github/workflows/stable-linux.yml | 5 +++++ check_tags.sh | 10 ++++++++-- stores/snapcraft/check_version.sh | 12 +++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stable-linux.yml b/.github/workflows/stable-linux.yml index 6ef268d..fffa514 100644 --- a/.github/workflows/stable-linux.yml +++ b/.github/workflows/stable-linux.yml @@ -9,6 +9,9 @@ on: generate_assets: type: boolean description: Generate assets + force_snap: + type: boolean + description: Force SNAP checkout_pr: type: string description: Checkout PR @@ -68,6 +71,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CHECK_ALL: 'yes' + FORCE_LINUX_SNAP: ${{ github.event.inputs.force_snap }} run: ./check_tags.sh compile: @@ -506,6 +510,7 @@ jobs: env: RELEASE_VERSION: ${{ needs.check.outputs.RELEASE_VERSION }} SNAP_NAME: codium + SNAP_PUBLISHER: vscodium strategy: fail-fast: false matrix: diff --git a/check_tags.sh b/check_tags.sh index c8a347a..e8b8ccc 100755 --- a/check_tags.sh +++ b/check_tags.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash # shellcheck disable=SC2129 +# Env Paramaters +# CHECK_ALL: yes | no +# CHECK_REH: yes | no +# CHECK_ONLY_REH: yes | no +# FORCE_LINUX_SNAP: true + set -e if [[ -z "${GH_TOKEN}" ]] && [[ -z "${GITHUB_TOKEN}" ]] && [[ -z "${GH_ENTERPRISE_TOKEN}" ]] && [[ -z "${GITHUB_ENTERPRISE_TOKEN}" ]]; then @@ -265,7 +271,7 @@ elif [[ "${ASSETS}" != "null" ]]; then export SHOULD_BUILD_TAR="no" fi - if [[ -z $( contains "arm64.snap" ) ]]; then + if [[ -z $( contains "arm64.snap" ) || "${FORCE_LINUX_SNAP}" == "true" ]]; then echo "Building on Linux arm64 because we have no SNAP" export SHOULD_BUILD="yes" else @@ -516,7 +522,7 @@ elif [[ "${ASSETS}" != "null" ]]; then export SHOULD_BUILD_APPIMAGE="no" fi - if [[ -z $( contains "amd64.snap" ) ]]; then + if [[ -z $( contains "amd64.snap" ) || "${FORCE_LINUX_SNAP}" == "true" ]]; then echo "Building on Linux x64 because we have no SNAP" export SHOULD_BUILD="yes" else diff --git a/stores/snapcraft/check_version.sh b/stores/snapcraft/check_version.sh index 8f3708b..b7d8f7b 100755 --- a/stores/snapcraft/check_version.sh +++ b/stores/snapcraft/check_version.sh @@ -26,9 +26,15 @@ else sudo snap install --channel "${CHANNEL}" --classic snapcraft + if [[ ! "$( snapcraft whoami )" =~ "${SNAP_PUBLISHER}" ]]; then + echo "FATAL -- Not authentificated" + + exit 1 + fi + echo "Architecture: ${ARCHITECTURE}" - SNAP_VERSION=$( snapcraft list-revisions "${SNAP_NAME}" | grep -F "${CHANNEL}*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4 ) + SNAP_VERSION=$( snapcraft revisions "${SNAP_NAME}" | grep -F "${CHANNEL}*" | grep "${ARCHITECTURE}" | tr -s ' ' | cut -d ' ' -f 4 ) echo "Snap version: ${SNAP_VERSION}" if [[ -n "${SNAP_VERSION}" && "${SNAP_VERSION}" != "${RELEASE_VERSION}" ]]; then @@ -45,4 +51,8 @@ if [[ "${GITHUB_ENV}" ]]; then echo "SHOULD_BUILD=${SHOULD_BUILD}" >> "${GITHUB_ENV}" echo "SHOULD_DEPLOY_TO_RELEASE=${SHOULD_DEPLOY_TO_RELEASE}" >> "${GITHUB_ENV}" echo "SHOULD_DEPLOY_TO_STORE=${SHOULD_DEPLOY_TO_STORE}" >> "${GITHUB_ENV}" +else + echo "SHOULD_BUILD=${SHOULD_BUILD}" + echo "SHOULD_DEPLOY_TO_RELEASE=${SHOULD_DEPLOY_TO_RELEASE}" + echo "SHOULD_DEPLOY_TO_STORE=${SHOULD_DEPLOY_TO_STORE}" fi