build(snap): add auth check

This commit is contained in:
Baptiste Augrain
2026-03-24 10:50:59 +01:00
parent 2c31dca7e2
commit 8077599387
3 changed files with 24 additions and 3 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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